sw_engine: fixed linear gradient filling masking.

properly filtering alpha channel of the 8bits linear gradient
masking drawing.

issue: https://github.com/thorvg/thorvg/issues/2204
This commit is contained in:
Hermet Park 2024-10-19 20:30:41 +09:00
parent 6427b81358
commit ec62ca869f

View file

@ -643,7 +643,7 @@ void fillLinear(const SwFill* fill, uint8_t* dst, uint32_t y, uint32_t x, uint32
auto t2 = static_cast<int32_t>(t * FIXPT_SIZE); auto t2 = static_cast<int32_t>(t * FIXPT_SIZE);
auto inc2 = static_cast<int32_t>(inc * FIXPT_SIZE); auto inc2 = static_cast<int32_t>(inc * FIXPT_SIZE);
for (uint32_t j = 0; j < len; ++j, ++dst) { for (uint32_t j = 0; j < len; ++j, ++dst) {
auto src = MULTIPLY(_fixedPixel(fill, t2), a); auto src = MULTIPLY(A(_fixedPixel(fill, t2)), a);
*dst = maskOp(src, *dst, ~src); *dst = maskOp(src, *dst, ~src);
t2 += inc2; t2 += inc2;
} }
@ -651,7 +651,7 @@ void fillLinear(const SwFill* fill, uint8_t* dst, uint32_t y, uint32_t x, uint32
} else { } else {
uint32_t counter = 0; uint32_t counter = 0;
while (counter++ < len) { while (counter++ < len) {
auto src = MULTIPLY(_pixel(fill, t / GRADIENT_STOP_SIZE), a); auto src = MULTIPLY(A(_pixel(fill, t / GRADIENT_STOP_SIZE)), a);
*dst = maskOp(src, *dst, ~src); *dst = maskOp(src, *dst, ~src);
++dst; ++dst;
t += inc; t += inc;