sw_engine: fix update issue

In cases where the fill was changed while the stroke existed
but remained unchanged, the stroke would disappear because it
was being reset during the shape preparing (shapeReset).
Fixed by disabling the reset of stroke rle from shape reseting.

Also the shape should be prepared not only when the RenderUpdateFlag
is set to Color, but also when it is set to Gradient.

@Issue: https://github.com/thorvg/thorvg/issues/3237
This commit is contained in:
Mira Grudzinska 2025-02-17 02:44:44 +01:00 committed by Hermet Park
parent ad261731b6
commit 259e380733
2 changed files with 2 additions and 3 deletions

View file

@ -123,8 +123,7 @@ struct SwShapeTask : SwTask
auto visibleFill = false;
//This checks also for the case, if the invisible shape turned to visible by alpha.
auto prepareShape = false;
if (!shapePrepared(&shape) && (flags & RenderUpdateFlag::Color)) prepareShape = true;
auto prepareShape = !shapePrepared(&shape) && flags & (RenderUpdateFlag::Color | RenderUpdateFlag::Gradient);
//Shape
if (flags & (RenderUpdateFlag::Path | RenderUpdateFlag::Transform) || prepareShape) {
@ -185,6 +184,7 @@ struct SwShapeTask : SwTask
err:
bbox.reset();
shapeReset(&shape);
rleReset(shape.strokeRle);
shapeDelOutline(&shape, mpool, tid);
}

View file

@ -461,7 +461,6 @@ void shapeDelOutline(SwShape* shape, SwMpool* mpool, uint32_t tid)
void shapeReset(SwShape* shape)
{
rleReset(shape->rle);
rleReset(shape->strokeRle);
shape->fastTrack = false;
shape->bbox.reset();
}