mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
sw_engine: rectified 8 grayscale drawing
8 bits matting images must be blended, not overwriting. issue: https://github.com/thorvg/thorvg/issues/1767
This commit is contained in:
parent
38dbd86d12
commit
36f5a8fd4e
1 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue