mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 21:53:41 +00:00
sw_engine: fix max length of trimmed strokes
The error was visible when multiple shapes were simultaneously trimmed. The length of a single shape was zeroed out only in selected cases, which caused accumulation that could lead to incorrect extension of the variable determining the maximum length. @issue: https://github.com/thorvg/thorvg/issues/2173
This commit is contained in:
parent
f61efc6d84
commit
3a03fd7080
1 changed files with 5 additions and 5 deletions
|
@ -370,8 +370,8 @@ static float _outlineLength(const RenderShape* rshape)
|
||||||
|
|
||||||
const Point* close = nullptr;
|
const Point* close = nullptr;
|
||||||
auto length = 0.0f;
|
auto length = 0.0f;
|
||||||
auto slength = 0.0f;
|
auto slength = -1.0f;
|
||||||
auto simutaneous = !rshape->stroke->trim.individual;
|
auto simultaneous = !rshape->stroke->trim.individual;
|
||||||
|
|
||||||
//Compute the whole length
|
//Compute the whole length
|
||||||
while (cmdCnt-- > 0) {
|
while (cmdCnt-- > 0) {
|
||||||
|
@ -379,8 +379,8 @@ static float _outlineLength(const RenderShape* rshape)
|
||||||
case PathCommand::Close: {
|
case PathCommand::Close: {
|
||||||
length += mathLength(pts - 1, close);
|
length += mathLength(pts - 1, close);
|
||||||
//retrieve the max length of the shape if the simultaneous mode.
|
//retrieve the max length of the shape if the simultaneous mode.
|
||||||
if (simutaneous && slength < length) {
|
if (simultaneous) {
|
||||||
slength = length;
|
if (slength < length) slength = length;
|
||||||
length = 0.0f;
|
length = 0.0f;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -403,7 +403,7 @@ static float _outlineLength(const RenderShape* rshape)
|
||||||
}
|
}
|
||||||
++cmds;
|
++cmds;
|
||||||
}
|
}
|
||||||
if (simutaneous && slength > length) return slength;
|
if (simultaneous && slength > length) return slength;
|
||||||
else return length;
|
else return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue