mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +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;
|
||||
auto length = 0.0f;
|
||||
auto slength = 0.0f;
|
||||
auto simutaneous = !rshape->stroke->trim.individual;
|
||||
auto slength = -1.0f;
|
||||
auto simultaneous = !rshape->stroke->trim.individual;
|
||||
|
||||
//Compute the whole length
|
||||
while (cmdCnt-- > 0) {
|
||||
|
@ -379,8 +379,8 @@ static float _outlineLength(const RenderShape* rshape)
|
|||
case PathCommand::Close: {
|
||||
length += mathLength(pts - 1, close);
|
||||
//retrieve the max length of the shape if the simultaneous mode.
|
||||
if (simutaneous && slength < length) {
|
||||
slength = length;
|
||||
if (simultaneous) {
|
||||
if (slength < length) slength = length;
|
||||
length = 0.0f;
|
||||
}
|
||||
break;
|
||||
|
@ -403,7 +403,7 @@ static float _outlineLength(const RenderShape* rshape)
|
|||
}
|
||||
++cmds;
|
||||
}
|
||||
if (simutaneous && slength > length) return slength;
|
||||
if (simultaneous && slength > length) return slength;
|
||||
else return length;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue