sw_engine: rectify the blending method of grayscale fill

issue: https://github.com/thorvg/thorvg/issues/2842
issue: https://github.com/thorvg/thorvg/issues/2841
This commit is contained in:
Hermet Park 2024-10-17 15:47:23 +09:00
parent b5943d627f
commit 719fbc9d64

View file

@ -1528,8 +1528,7 @@ static bool _rasterTranslucentGradientRle(SwSurface* surface, const SwRle* rle,
} else if (surface->channelSize == sizeof(uint8_t)) {
for (uint32_t i = 0; i < rle->size; ++i, ++span) {
auto dst = &surface->buf8[span->y * surface->stride + span->x];
if (span->coverage == 255) fillMethod()(fill, dst, span->y, span->x, span->len, _opMaskNone, 255);
else fillMethod()(fill, dst, span->y, span->x, span->len, _opMaskAdd, span->coverage);
fillMethod()(fill, dst, span->y, span->x, span->len, _opMaskAdd, span->coverage);
}
}
return true;
@ -1586,9 +1585,9 @@ static bool _rasterRadialGradientRle(SwSurface* surface, const SwRle* rle, const
if (_matting(surface)) return _rasterGradientMattedRle<FillRadial>(surface, rle, fill);
else return _rasterGradientMaskedRle<FillRadial>(surface, rle, fill);
} else if (_blending(surface)) {
_rasterBlendingGradientRle<FillRadial>(surface, rle, fill);
return _rasterBlendingGradientRle<FillRadial>(surface, rle, fill);
} else {
if (fill->translucent) _rasterTranslucentGradientRle<FillRadial>(surface, rle, fill);
if (fill->translucent) return _rasterTranslucentGradientRle<FillRadial>(surface, rle, fill);
else return _rasterSolidGradientRle<FillRadial>(surface, rle, fill);
}
return false;