22 #ifndef GRAPHICS_BLIT_H 23 #define GRAPHICS_BLIT_H 25 #include "graphics/pixelformat.h" 26 #include "graphics/transform_struct.h" 32 class BlendBlitUnfilteredTestSuite;
45 struct TransformStruct;
48 inline static void convertPaletteToMap(uint32 *dst,
const byte *src, uint colors,
const Graphics::PixelFormat &format) {
49 while (colors-- > 0) {
50 *dst++ = format.
RGBToColor(src[0], src[1], src[2]);
69 void copyBlit(byte *dst,
const byte *src,
70 const uint dstPitch,
const uint srcPitch,
71 const uint w,
const uint h,
72 const uint bytesPerPixel);
86 bool keyBlit(byte *dst,
const byte *src,
87 const uint dstPitch,
const uint srcPitch,
88 const uint w,
const uint h,
89 const uint bytesPerPixel,
const uint32 key);
108 bool maskBlit(byte *dst,
const byte *src,
const byte *mask,
109 const uint dstPitch,
const uint srcPitch,
const uint maskPitch,
110 const uint w,
const uint h,
111 const uint bytesPerPixel);
134 bool crossBlit(byte *dst,
const byte *src,
135 const uint dstPitch,
const uint srcPitch,
136 const uint w,
const uint h,
162 const uint dstPitch,
const uint srcPitch,
163 const uint w,
const uint h,
193 bool crossMaskBlit(byte *dst,
const byte *src,
const byte *mask,
194 const uint dstPitch,
const uint srcPitch,
const uint maskPitch,
195 const uint w,
const uint h,
198 bool crossBlitMap(byte *dst,
const byte *src,
199 const uint dstPitch,
const uint srcPitch,
200 const uint w,
const uint h,
201 const uint bytesPerPixel,
const uint32 *map);
203 bool crossKeyBlitMap(byte *dst,
const byte *src,
204 const uint dstPitch,
const uint srcPitch,
205 const uint w,
const uint h,
206 const uint bytesPerPixel,
const uint32 *map,
const uint32 key);
208 bool crossMaskBlitMap(byte *dst,
const byte *src,
const byte *mask,
209 const uint dstPitch,
const uint srcPitch,
const uint maskPitch,
210 const uint w,
const uint h,
211 const uint bytesPerPixel,
const uint32 *map);
213 typedef void (*FastBlitFunc)(byte *,
const byte *,
const uint,
const uint,
const uint,
const uint);
217 void fastBlitNEON_XRGB1555_RGB565(byte *,
const byte *,
const uint,
const uint,
const uint,
const uint);
239 FastBlitFunc
getFastBlitFunc(
const PixelFormat &dstFmt,
const PixelFormat &srcFmt);
241 bool scaleBlit(byte *dst,
const byte *src,
242 const uint dstPitch,
const uint srcPitch,
243 const uint dstW,
const uint dstH,
244 const uint srcW,
const uint srcH,
246 const byte flip = 0);
248 bool scaleBlitBilinear(byte *dst,
const byte *src,
249 const uint dstPitch,
const uint srcPitch,
250 const uint dstW,
const uint dstH,
251 const uint srcW,
const uint srcH,
253 const byte flip = 0);
255 bool rotoscaleBlit(byte *dst,
const byte *src,
256 const uint dstPitch,
const uint srcPitch,
257 const uint dstW,
const uint dstH,
258 const uint srcW,
const uint srcH,
260 const TransformStruct &transform,
263 bool rotoscaleBlitBilinear(byte *dst,
const byte *src,
264 const uint dstPitch,
const uint srcPitch,
265 const uint dstW,
const uint dstH,
266 const uint srcW,
const uint srcH,
268 const TransformStruct &transform,
271 bool applyColorKey(byte *dst,
const byte *src,
272 const uint dstPitch,
const uint srcPitch,
273 const uint w,
const uint h,
275 const uint8 rKey,
const uint8 gKey,
const uint8 bKey,
276 const uint8 rNew,
const uint8 gNew,
const uint8 bNew);
278 bool setAlpha(byte *dst,
const byte *src,
279 const uint dstPitch,
const uint srcPitch,
280 const uint w,
const uint h,
282 const bool skipTransparent,
const uint8 alpha);
288 bool rgbmod, alphamod;
294 int scaleX, scaleY, scaleXoff, scaleYoff;
300 Args(byte *dst,
const byte *src,
301 const uint dstPitch,
const uint srcPitch,
302 const int posX,
const int posY,
303 const uint width,
const uint height,
304 const int scaleX,
const int scaleY,
305 const int scaleXsrcOff,
const int scaleYsrcOff,
306 const uint32 colorMod,
const uint flipping);
310 static void blitNEON(Args &args,
const TSpriteBlendMode &blendMode,
const AlphaType &alphaType);
313 static void blitSSE2(Args &args,
const TSpriteBlendMode &blendMode,
const AlphaType &alphaType);
316 static void blitAVX2(Args &args,
const TSpriteBlendMode &blendMode,
const AlphaType &alphaType);
318 static void blitGeneric(Args &args,
const TSpriteBlendMode &blendMode,
const AlphaType &alphaType);
320 static void blitT(Args &args,
const TSpriteBlendMode &blendMode,
const AlphaType &alphaType);
322 typedef void(*BlitFunc)(Args &,
const TSpriteBlendMode &,
const AlphaType &);
323 static BlitFunc blitFunc;
325 static void fillGeneric(Args &args,
const TSpriteBlendMode &blendMode);
327 static void fillT(Args &args,
const TSpriteBlendMode &blendMode);
329 typedef void(*FillFunc)(Args &,
const TSpriteBlendMode &);
330 static FillFunc fillFunc;
332 friend class ::BlendBlitUnfilteredTestSuite;
333 friend class BlendBlitImpl_Default;
334 friend class BlendBlitImpl_NEON;
335 friend class BlendBlitImpl_SSE2;
336 friend class BlendBlitImpl_AVX2;
339 static const int SCALE_THRESHOLD = 0x100;
340 static const int kBModShift = 8;
341 static const int kGModShift = 16;
342 static const int kRModShift = 24;
343 static const int kAModShift = 0;
345 static const uint32 kBModMask = 0x0000ff00;
346 static const uint32 kGModMask = 0x00ff0000;
347 static const uint32 kRModMask = 0xff000000;
348 static const uint32 kAModMask = 0x000000ff;
349 static const uint32 kRGBModMask = (kRModMask | kGModMask | kBModMask);
351 #ifdef SCUMM_LITTLE_ENDIAN 352 static const int kAIndex = 0;
353 static const int kBIndex = 1;
354 static const int kGIndex = 2;
355 static const int kRIndex = 3;
357 static const int kAIndex = 3;
358 static const int kBIndex = 2;
359 static const int kGIndex = 1;
360 static const int kRIndex = 0;
363 static inline int getScaleFactor(
int srcSize,
int dstSize) {
364 return SCALE_THRESHOLD * srcSize / dstSize;
401 static void blit(byte *dst,
const byte *src,
402 const uint dstPitch,
const uint srcPitch,
403 const int posX,
const int posY,
404 const uint width,
const uint height,
405 const int scaleX,
const int scaleY,
406 const int scaleXsrcOff,
const int scaleYsrcOff,
407 const uint32 colorMod,
const uint flipping,
408 const TSpriteBlendMode blendMode,
409 const AlphaType alphaType);
421 static void fill(byte *dst,
const uint dstPitch,
422 const uint width,
const uint height,
423 const uint32 colorMod,
424 const TSpriteBlendMode blendMode);
431 #endif // GRAPHICS_BLIT_H static PixelFormat getSupportedPixelFormat()
Definition: blit.h:375
Definition: display_client.h:58
bool crossBlit(byte *dst, const byte *src, const uint dstPitch, const uint srcPitch, const uint w, const uint h, const Graphics::PixelFormat &dstFmt, const Graphics::PixelFormat &srcFmt)
bool crossKeyBlit(byte *dst, const byte *src, const uint dstPitch, const uint srcPitch, const uint w, const uint h, const Graphics::PixelFormat &dstFmt, const Graphics::PixelFormat &srcFmt, const uint32 key)
Definition: algorithm.h:29
Definition: formatinfo.h:28
void copyBlit(byte *dst, const byte *src, const uint dstPitch, const uint srcPitch, const uint w, const uint h, const uint bytesPerPixel)
signed char * fill(signed char *first, signed char *last, Value val)
Definition: algorithm.h:168
FastBlitFunc getFastBlitFunc(const PixelFormat &dstFmt, const PixelFormat &srcFmt)
bool crossMaskBlit(byte *dst, const byte *src, const byte *mask, const uint dstPitch, const uint srcPitch, const uint maskPitch, const uint w, const uint h, const Graphics::PixelFormat &dstFmt, const Graphics::PixelFormat &srcFmt)
bool keyBlit(byte *dst, const byte *src, const uint dstPitch, const uint srcPitch, const uint w, const uint h, const uint bytesPerPixel, const uint32 key)
bool maskBlit(byte *dst, const byte *src, const byte *mask, const uint dstPitch, const uint srcPitch, const uint maskPitch, const uint w, const uint h, const uint bytesPerPixel)