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]);
66 void copyBlit(byte *dst,
const byte *src,
67 const uint dstPitch,
const uint srcPitch,
68 const uint w,
const uint h,
69 const uint bytesPerPixel);
83 bool keyBlit(byte *dst,
const byte *src,
84 const uint dstPitch,
const uint srcPitch,
85 const uint w,
const uint h,
86 const uint bytesPerPixel,
const uint32 key);
105 bool maskBlit(byte *dst,
const byte *src,
const byte *mask,
106 const uint dstPitch,
const uint srcPitch,
const uint maskPitch,
107 const uint w,
const uint h,
108 const uint bytesPerPixel);
131 bool crossBlit(byte *dst,
const byte *src,
132 const uint dstPitch,
const uint srcPitch,
133 const uint w,
const uint h,
159 const uint dstPitch,
const uint srcPitch,
160 const uint w,
const uint h,
190 bool crossMaskBlit(byte *dst,
const byte *src,
const byte *mask,
191 const uint dstPitch,
const uint srcPitch,
const uint maskPitch,
192 const uint w,
const uint h,
195 bool crossBlitMap(byte *dst,
const byte *src,
196 const uint dstPitch,
const uint srcPitch,
197 const uint w,
const uint h,
198 const uint bytesPerPixel,
const uint32 *map);
200 bool crossKeyBlitMap(byte *dst,
const byte *src,
201 const uint dstPitch,
const uint srcPitch,
202 const uint w,
const uint h,
203 const uint bytesPerPixel,
const uint32 *map,
const uint32 key);
205 bool crossMaskBlitMap(byte *dst,
const byte *src,
const byte *mask,
206 const uint dstPitch,
const uint srcPitch,
const uint maskPitch,
207 const uint w,
const uint h,
208 const uint bytesPerPixel,
const uint32 *map);
210 bool scaleBlit(byte *dst,
const byte *src,
211 const uint dstPitch,
const uint srcPitch,
212 const uint dstW,
const uint dstH,
213 const uint srcW,
const uint srcH,
215 const byte flip = 0);
217 bool scaleBlitBilinear(byte *dst,
const byte *src,
218 const uint dstPitch,
const uint srcPitch,
219 const uint dstW,
const uint dstH,
220 const uint srcW,
const uint srcH,
222 const byte flip = 0);
224 bool rotoscaleBlit(byte *dst,
const byte *src,
225 const uint dstPitch,
const uint srcPitch,
226 const uint dstW,
const uint dstH,
227 const uint srcW,
const uint srcH,
229 const TransformStruct &transform,
232 bool rotoscaleBlitBilinear(byte *dst,
const byte *src,
233 const uint dstPitch,
const uint srcPitch,
234 const uint dstW,
const uint dstH,
235 const uint srcW,
const uint srcH,
237 const TransformStruct &transform,
240 bool applyColorKey(byte *dst,
const byte *src,
241 const uint dstPitch,
const uint srcPitch,
242 const uint w,
const uint h,
244 const uint8 rKey,
const uint8 gKey,
const uint8 bKey,
245 const uint8 rNew,
const uint8 gNew,
const uint8 bNew);
247 bool setAlpha(byte *dst,
const byte *src,
248 const uint dstPitch,
const uint srcPitch,
249 const uint w,
const uint h,
251 const bool skipTransparent,
const uint8 alpha);
257 bool rgbmod, alphamod;
263 int scaleX, scaleY, scaleXoff, scaleYoff;
269 Args(byte *dst,
const byte *src,
270 const uint dstPitch,
const uint srcPitch,
271 const int posX,
const int posY,
272 const uint width,
const uint height,
273 const int scaleX,
const int scaleY,
274 const int scaleXsrcOff,
const int scaleYsrcOff,
275 const uint32 colorMod,
const uint flipping);
279 static void blitNEON(Args &args,
const TSpriteBlendMode &blendMode,
const AlphaType &alphaType);
282 static void blitSSE2(Args &args,
const TSpriteBlendMode &blendMode,
const AlphaType &alphaType);
285 static void blitAVX2(Args &args,
const TSpriteBlendMode &blendMode,
const AlphaType &alphaType);
287 static void blitGeneric(Args &args,
const TSpriteBlendMode &blendMode,
const AlphaType &alphaType);
289 static void blitT(Args &args,
const TSpriteBlendMode &blendMode,
const AlphaType &alphaType);
290 #undef LOGIC_FUNCS_EXT 292 typedef void(*BlitFunc)(Args &,
const TSpriteBlendMode &,
const AlphaType &);
293 static BlitFunc blitFunc;
294 friend class ::BlendBlitUnfilteredTestSuite;
295 friend class BlendBlitImpl_Default;
296 friend class BlendBlitImpl_NEON;
297 friend class BlendBlitImpl_SSE2;
298 friend class BlendBlitImpl_AVX2;
301 static const int SCALE_THRESHOLD = 0x100;
302 static const int kBModShift = 8;
303 static const int kGModShift = 16;
304 static const int kRModShift = 24;
305 static const int kAModShift = 0;
307 static const uint32 kBModMask = 0x0000ff00;
308 static const uint32 kGModMask = 0x00ff0000;
309 static const uint32 kRModMask = 0xff000000;
310 static const uint32 kAModMask = 0x000000ff;
311 static const uint32 kRGBModMask = (kRModMask | kGModMask | kBModMask);
313 #ifdef SCUMM_LITTLE_ENDIAN 314 static const int kAIndex = 0;
315 static const int kBIndex = 1;
316 static const int kGIndex = 2;
317 static const int kRIndex = 3;
319 static const int kAIndex = 3;
320 static const int kBIndex = 2;
321 static const int kGIndex = 1;
322 static const int kRIndex = 0;
325 static inline int getScaleFactor(
int srcSize,
int dstSize) {
326 return SCALE_THRESHOLD * srcSize / dstSize;
363 static void blit(byte *dst,
const byte *src,
364 const uint dstPitch,
const uint srcPitch,
365 const int posX,
const int posY,
366 const uint width,
const uint height,
367 const int scaleX,
const int scaleY,
368 const int scaleXsrcOff,
const int scaleYsrcOff,
369 const uint32 colorMod,
const uint flipping,
370 const TSpriteBlendMode blendMode,
371 const AlphaType alphaType);
378 #endif // GRAPHICS_BLIT_H static PixelFormat getSupportedPixelFormat()
Definition: blit.h:337
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)
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)