mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
sw_engine raster: fixing rasterization of an image with InvMask
In case of the image rasterization with an inverse mask the opacity was omitted and the alpha value instead of the inverse alpha value was used.
This commit is contained in:
parent
028e1fa251
commit
5e1d3772ca
1 changed files with 3 additions and 2 deletions
|
@ -454,7 +454,8 @@ static bool _translucentImageInvAlphaMask(SwSurface* surface, const uint32_t *im
|
|||
auto rX = static_cast<uint32_t>(roundf(x * invTransform->e11 + ey1));
|
||||
auto rY = static_cast<uint32_t>(roundf(x * invTransform->e21 + ey2));
|
||||
if (rX >= w || rY >= h) continue;
|
||||
auto tmp = ALPHA_BLEND(img[rX + (rY * w)], ALPHA_MULTIPLY(opacity, surface->blender.alpha(*cmp))); //TODO: need to use image's stride
|
||||
auto ialpha = 255 - surface->blender.alpha(*cmp);
|
||||
auto tmp = ALPHA_BLEND(img[rX + (rY * w)], ALPHA_MULTIPLY(opacity, ialpha)); //TODO: need to use image's stride
|
||||
*dst = tmp + ALPHA_BLEND(*dst, 255 - surface->blender.alpha(tmp));
|
||||
}
|
||||
}
|
||||
|
@ -534,7 +535,7 @@ static bool _translucentImageInvAlphaMask(SwSurface* surface, uint32_t *img, uin
|
|||
auto src = &sbuffer[y * w]; //TODO: need to use image's stride
|
||||
for (uint32_t x = 0; x < w2; ++x, ++dst, ++src, ++cmp) {
|
||||
auto ialpha = 255 - surface->blender.alpha(*cmp);
|
||||
auto tmp = ALPHA_BLEND(*src, ialpha);
|
||||
auto tmp = ALPHA_BLEND(*src, ALPHA_MULTIPLY(opacity, ialpha));
|
||||
*dst = tmp + ALPHA_BLEND(*dst, 255 - surface->blender.alpha(tmp));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue