renderer: fix render region for multiple masks

Previously, when more than two masks were applied,
the render region only took the first added mask into
account.

@Issue: https://github.com/thorvg/thorvg/issues/3600
This commit is contained in:
Mira Grudzinska 2025-07-08 10:43:49 +02:00
parent 9d7cd877e8
commit f56879b295

View file

@ -214,8 +214,12 @@ bool Paint::Impl::render(RenderMethod* renderer)
RenderRegion region;
PAINT_METHOD(region, bounds(renderer));
if (MASK_REGION_MERGING(compData->method)) region.add(P(compData->target)->bounds(renderer));
if (region.w == 0 || region.h == 0) return true;
auto cData = compData;
while (cData) {
if (MASK_REGION_MERGING(cData->method)) region.add(P(cData->target)->bounds(renderer));
if (region.w == 0 || region.h == 0) return true;
cData = P(cData->target)->compData;
}
cmp = renderer->target(region, COMPOSITE_TO_COLORSPACE(renderer, compData->method), CompositionFlag::Masking);
if (renderer->beginComposite(cmp, CompositeMethod::None, 255)) {
compData->target->pImpl->render(renderer);