sw_engine: fix _rasterDirectImage

Since the source buffer is 32 bits, not 8 bits,
both alpha and inverse alpha need to be calculated.
This commit is contained in:
Mira Grudzinska 2024-10-17 20:47:36 +07:00 committed by Hermet Park
parent 9ce784751c
commit fa49f14412

View file

@ -1170,11 +1170,11 @@ static bool _rasterDirectImage(SwSurface* surface, const SwImage* image, const S
auto src = sbuffer; auto src = sbuffer;
if (opacity == 255) { if (opacity == 255) {
for (auto x = region.min.x; x < region.max.x; ++x, ++dst, ++src) { for (auto x = region.min.x; x < region.max.x; ++x, ++dst, ++src) {
*dst = *src + MULTIPLY(*dst, ~*src); *dst = *src + MULTIPLY(*dst, IA(*src));
} }
} else { } else {
for (auto x = region.min.x; x < region.max.x; ++x, ++dst, ++src) { for (auto x = region.min.x; x < region.max.x; ++x, ++dst, ++src) {
*dst = INTERPOLATE8(*src, *dst, opacity); *dst = INTERPOLATE8(A(*src), *dst, opacity);
} }
} }
} }