diff --git a/src/renderer/sw_engine/tvgSwRaster.cpp b/src/renderer/sw_engine/tvgSwRaster.cpp index 8e689811..5d5f066c 100644 --- a/src/renderer/sw_engine/tvgSwRaster.cpp +++ b/src/renderer/sw_engine/tvgSwRaster.cpp @@ -1338,11 +1338,13 @@ static bool _rasterDirectMattedImage(SwSurface* surface, const SwImage* image, c auto src = sbuffer; if (opacity == 255) { for (uint32_t x = 0; x < w; ++x, ++dst, ++src, cmp += csize) { - *dst = MULTIPLY(A(*src), alpha(cmp)); + auto tmp = MULTIPLY(A(*src), alpha(cmp)); + *dst = tmp + MULTIPLY(*dst, 255 - tmp); } } else { for (uint32_t x = 0; x < w; ++x, ++dst, ++src, cmp += csize) { - *dst = MULTIPLY(A(*src), MULTIPLY(opacity, alpha(cmp))); + auto tmp = MULTIPLY(A(*src), MULTIPLY(opacity, alpha(cmp))); + *dst = tmp + MULTIPLY(*dst, 255 - tmp); } } buffer += surface->stride;