mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-15 04:24:28 +00:00
sw_engine renderer: fix invalid rle issue.
if shape rendering is failed, all the prepared data must be reset because those are invalid. @Issues: 180
This commit is contained in:
parent
736d6ee4ef
commit
0e9115cd00
1 changed files with 8 additions and 4 deletions
|
@ -91,13 +91,13 @@ struct SwShapeTask : SwTask
|
||||||
bool renderShape = (alpha > 0 || sdata->fill());
|
bool renderShape = (alpha > 0 || sdata->fill());
|
||||||
if (renderShape || strokeAlpha) {
|
if (renderShape || strokeAlpha) {
|
||||||
shapeReset(&shape);
|
shapeReset(&shape);
|
||||||
if (!shapePrepare(&shape, sdata, tid, clip, transform, bbox)) goto end;
|
if (!shapePrepare(&shape, sdata, tid, clip, transform, bbox)) goto err;
|
||||||
if (renderShape) {
|
if (renderShape) {
|
||||||
/* We assume that if stroke width is bigger than 2,
|
/* We assume that if stroke width is bigger than 2,
|
||||||
shape outline below stroke could be full covered by stroke drawing.
|
shape outline below stroke could be full covered by stroke drawing.
|
||||||
Thus it turns off antialising in that condition. */
|
Thus it turns off antialising in that condition. */
|
||||||
auto antiAlias = (strokeAlpha == 255 && strokeWidth > 2) ? false : true;
|
auto antiAlias = (strokeAlpha == 255 && strokeWidth > 2) ? false : true;
|
||||||
if (!shapeGenRle(&shape, sdata, clip, antiAlias, clips.count > 0 ? true : false)) goto end;
|
if (!shapeGenRle(&shape, sdata, clip, antiAlias, clips.count > 0 ? true : false)) goto err;
|
||||||
++addStroking;
|
++addStroking;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ struct SwShapeTask : SwTask
|
||||||
if (fill) {
|
if (fill) {
|
||||||
auto ctable = (flags & RenderUpdateFlag::Gradient) ? true : false;
|
auto ctable = (flags & RenderUpdateFlag::Gradient) ? true : false;
|
||||||
if (ctable) shapeResetFill(&shape);
|
if (ctable) shapeResetFill(&shape);
|
||||||
if (!shapeGenFillColors(&shape, fill, transform, surface, opacity, ctable)) goto end;
|
if (!shapeGenFillColors(&shape, fill, transform, surface, opacity, ctable)) goto err;
|
||||||
++addStroking;
|
++addStroking;
|
||||||
} else {
|
} else {
|
||||||
shapeDelFill(&shape);
|
shapeDelFill(&shape);
|
||||||
|
@ -120,7 +120,7 @@ struct SwShapeTask : SwTask
|
||||||
if (flags & (RenderUpdateFlag::Stroke | RenderUpdateFlag::Transform)) {
|
if (flags & (RenderUpdateFlag::Stroke | RenderUpdateFlag::Transform)) {
|
||||||
if (strokeAlpha > 0) {
|
if (strokeAlpha > 0) {
|
||||||
shapeResetStroke(&shape, sdata, transform);
|
shapeResetStroke(&shape, sdata, transform);
|
||||||
if (!shapeGenStrokeRle(&shape, sdata, tid, transform, clip, bbox)) goto end;
|
if (!shapeGenStrokeRle(&shape, sdata, tid, transform, clip, bbox)) goto err;
|
||||||
++addStroking;
|
++addStroking;
|
||||||
} else {
|
} else {
|
||||||
shapeDelStroke(&shape);
|
shapeDelStroke(&shape);
|
||||||
|
@ -141,6 +141,10 @@ struct SwShapeTask : SwTask
|
||||||
else if (clipper->rle) rleClipPath(shape.strokeRle, clipper->rle);
|
else if (clipper->rle) rleClipPath(shape.strokeRle, clipper->rle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
goto end;
|
||||||
|
|
||||||
|
err:
|
||||||
|
shapeReset(&shape);
|
||||||
end:
|
end:
|
||||||
shapeDelOutline(&shape, tid);
|
shapeDelOutline(&shape, tid);
|
||||||
if (addStroking > 1 && opacity < 255) cmpStroking = true;
|
if (addStroking > 1 && opacity < 255) cmpStroking = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue