mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-05 00:36:57 +00:00
GRAPHICS: Fixing blendBlitTo bugs
This commit is contained in:
parent
5112d79690
commit
9d354fc636
@ -74,7 +74,7 @@ struct AlphaBlend {
|
||||
return _mm256_or_si256(dst, src);
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
uint32 ina = in[BlendBlit::kAIndex] * ca >> 8;
|
||||
|
||||
if (ina != 0) {
|
||||
@ -130,7 +130,7 @@ struct MultiplyBlend {
|
||||
return _mm256_or_si256(dst, src);
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
uint32 ina = in[BlendBlit::kAIndex] * ca >> 8;
|
||||
|
||||
if (ina != 0) {
|
||||
@ -147,7 +147,7 @@ struct OpaqueBlend {
|
||||
return _mm256_or_si256(src, _mm256_set1_epi32(BlendBlit::kAModMask));
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
*(uint32 *)out = *(const uint32 *)in | BlendBlit::kAModMask;
|
||||
}
|
||||
};
|
||||
@ -161,7 +161,7 @@ struct BinaryBlend {
|
||||
return _mm256_or_si256(src, dst);
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
uint32 pix = *(const uint32 *)in;
|
||||
int a = in[BlendBlit::kAIndex];
|
||||
|
||||
@ -225,7 +225,7 @@ struct AdditiveBlend {
|
||||
return _mm256_or_si256(dst, src);
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
uint32 ina = in[BlendBlit::kAIndex] * ca >> 8;
|
||||
|
||||
if (ina != 0) {
|
||||
@ -254,7 +254,7 @@ struct SubtractiveBlend {
|
||||
return _mm256_or_si256(_mm256_set1_epi32(BlendBlit::kAModMask), _mm256_or_si256(srcb, _mm256_or_si256(srcg, srcr)));
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
out[BlendBlit::kAIndex] = 255;
|
||||
out[BlendBlit::kBIndex] = MAX<int32>(out[BlendBlit::kBIndex] - ((in[BlendBlit::kBIndex] * cb * (out[BlendBlit::kBIndex]) * in[BlendBlit::kAIndex]) >> 24), 0);
|
||||
out[BlendBlit::kGIndex] = MAX<int32>(out[BlendBlit::kGIndex] - ((in[BlendBlit::kGIndex] * cg * (out[BlendBlit::kGIndex]) * in[BlendBlit::kAIndex]) >> 24), 0);
|
||||
@ -327,7 +327,7 @@ static void blitInnerLoop(BlendBlit::Args &args) {
|
||||
in = inBase + scaleXCtr / BlendBlit::SCALE_THRESHOLD * args.inStep;
|
||||
}
|
||||
|
||||
PixelFunc<doscale, rgbmod, alphamod>::normal(in, out, args.flipping & FLIP_H, ca, cr, cg, cb);
|
||||
PixelFunc<doscale, rgbmod, alphamod>::normal(in, out, ca, cr, cg, cb);
|
||||
|
||||
if (doscale)
|
||||
scaleXCtr += args.scaleX;
|
||||
|
@ -74,7 +74,7 @@ struct AlphaBlend {
|
||||
return vorrq_u32(dst, src);
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
uint32 ina = in[BlendBlit::kAIndex] * ca >> 8;
|
||||
|
||||
if (ina != 0) {
|
||||
@ -130,7 +130,7 @@ struct MultiplyBlend {
|
||||
return vorrq_u32(dst, src);
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
uint32 ina = in[BlendBlit::kAIndex] * ca >> 8;
|
||||
|
||||
if (ina != 0) {
|
||||
@ -147,7 +147,7 @@ struct OpaqueBlend {
|
||||
return vorrq_u32(src, vmovq_n_u32(BlendBlit::kAModMask));
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
*(uint32 *)out = *(const uint32 *)in | BlendBlit::kAModMask;
|
||||
}
|
||||
};
|
||||
@ -161,7 +161,7 @@ struct BinaryBlend {
|
||||
return vorrq_u32(dst, src);
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
uint32 pix = *(const uint32 *)in;
|
||||
int a = in[BlendBlit::kAIndex];
|
||||
|
||||
@ -225,7 +225,7 @@ struct AdditiveBlend {
|
||||
return vorrq_u32(dst, src);
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
uint32 ina = in[BlendBlit::kAIndex] * ca >> 8;
|
||||
|
||||
if (ina != 0) {
|
||||
@ -254,7 +254,7 @@ struct SubtractiveBlend {
|
||||
return vorrq_u32(vmovq_n_u32(BlendBlit::kAModMask), vorrq_u32(srcb, vorrq_u32(srcg, srcr)));
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
out[BlendBlit::kAIndex] = 255;
|
||||
out[BlendBlit::kBIndex] = MAX<int32>(out[BlendBlit::kBIndex] - ((in[BlendBlit::kBIndex] * cb * (out[BlendBlit::kBIndex]) * in[BlendBlit::kAIndex]) >> 24), 0);
|
||||
out[BlendBlit::kGIndex] = MAX<int32>(out[BlendBlit::kGIndex] - ((in[BlendBlit::kGIndex] * cg * (out[BlendBlit::kGIndex]) * in[BlendBlit::kAIndex]) >> 24), 0);
|
||||
@ -325,7 +325,7 @@ static inline void blitInnerLoop(BlendBlit::Args &args) {
|
||||
in = inBase + scaleXCtr / BlendBlit::SCALE_THRESHOLD * args.inStep;
|
||||
}
|
||||
|
||||
PixelFunc<doscale, rgbmod, alphamod>::normal(in, out, args.flipping & FLIP_H, ca, cr, cg, cb);
|
||||
PixelFunc<doscale, rgbmod, alphamod>::normal(in, out, ca, cr, cg, cb);
|
||||
|
||||
if (doscale)
|
||||
scaleXCtr += args.scaleX;
|
||||
|
@ -80,7 +80,7 @@ struct AlphaBlend {
|
||||
return _mm_or_si128(dst, src);
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
uint32 ina = in[BlendBlit::kAIndex] * ca >> 8;
|
||||
|
||||
if (ina != 0) {
|
||||
@ -136,7 +136,7 @@ struct MultiplyBlend {
|
||||
return _mm_or_si128(dst, src);
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
uint32 ina = in[BlendBlit::kAIndex] * ca >> 8;
|
||||
|
||||
if (ina != 0) {
|
||||
@ -153,7 +153,7 @@ struct OpaqueBlend {
|
||||
return _mm_or_si128(src, _mm_set1_epi32(BlendBlit::kAModMask));
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
*(uint32 *)out = *(const uint32 *)in | BlendBlit::kAModMask;
|
||||
}
|
||||
};
|
||||
@ -167,7 +167,7 @@ struct BinaryBlend {
|
||||
return _mm_or_si128(src, dst);
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
uint32 pix = *(const uint32 *)in;
|
||||
int a = in[BlendBlit::kAIndex];
|
||||
|
||||
@ -231,7 +231,7 @@ struct AdditiveBlend {
|
||||
return _mm_or_si128(dst, src);
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
uint32 ina = in[BlendBlit::kAIndex] * ca >> 8;
|
||||
|
||||
if (ina != 0) {
|
||||
@ -260,7 +260,7 @@ struct SubtractiveBlend {
|
||||
return _mm_or_si128(_mm_set1_epi32(BlendBlit::kAModMask), _mm_or_si128(srcb, _mm_or_si128(srcg, srcr)));
|
||||
}
|
||||
|
||||
static inline void normal(const byte *in, byte *out, const bool flip, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
static inline void normal(const byte *in, byte *out, const byte ca, const byte cr, const byte cg, const byte cb) {
|
||||
out[BlendBlit::kAIndex] = 255;
|
||||
out[BlendBlit::kBIndex] = MAX<int32>(out[BlendBlit::kBIndex] - ((in[BlendBlit::kBIndex] * cb * (out[BlendBlit::kBIndex]) * in[BlendBlit::kAIndex]) >> 24), 0);
|
||||
out[BlendBlit::kGIndex] = MAX<int32>(out[BlendBlit::kGIndex] - ((in[BlendBlit::kGIndex] * cg * (out[BlendBlit::kGIndex]) * in[BlendBlit::kAIndex]) >> 24), 0);
|
||||
@ -328,7 +328,7 @@ static inline void blitInnerLoop(BlendBlit::Args &args) {
|
||||
in = inBase + scaleXCtr / BlendBlit::SCALE_THRESHOLD * args.inStep;
|
||||
}
|
||||
|
||||
PixelFunc<doscale, rgbmod, alphamod>::normal(in, out, args.flipping & FLIP_H, ca, cr, cg, cb);
|
||||
PixelFunc<doscale, rgbmod, alphamod>::normal(in, out, ca, cr, cg, cb);
|
||||
|
||||
if (doscale)
|
||||
scaleXCtr += args.scaleX;
|
||||
|
@ -82,10 +82,10 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p
|
||||
}
|
||||
|
||||
if (width == -1) {
|
||||
width = srcImage.w;
|
||||
width = srcW;
|
||||
}
|
||||
if (height == -1) {
|
||||
height = srcImage.h;
|
||||
height = srcH;
|
||||
}
|
||||
|
||||
int scaleX = BlendBlit::getScaleFactor(srcW, width), scaleXoff = 0;
|
||||
@ -182,10 +182,10 @@ Common::Rect TransparentSurface::blitClip(Graphics::Surface &target, Common::Rec
|
||||
}
|
||||
|
||||
if (width == -1) {
|
||||
width = srcImage.w;
|
||||
width = srcW;
|
||||
}
|
||||
if (height == -1) {
|
||||
height = srcImage.h;
|
||||
height = srcH;
|
||||
}
|
||||
|
||||
int scaleX = BlendBlit::getScaleFactor(srcW, width), scaleXoff = 0;;
|
||||
|
Loading…
Reference in New Issue
Block a user