mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 19:44:28 +00:00
sw_engine: Address a corner case in trim path handling
This update fixes an issue where duplicated overlapping curves/lines, when introduced as a single line. That case overlapping command operation is take account for the trim path's path-building process. We now skip such cases to ensure the trim path functions correctly. issue: https://github.com/thorvg/thorvg/issues/1939
This commit is contained in:
parent
07b11e0528
commit
a88f7094c4
1 changed files with 6 additions and 2 deletions
|
@ -122,7 +122,9 @@ static void _dashLineTo(SwDashStroke& dash, const Point* to, const Matrix* trans
|
|||
Line cur = {dash.ptCur, *to};
|
||||
auto len = _lineLength(cur.pt1, cur.pt2);
|
||||
|
||||
if (len < dash.curLen) {
|
||||
if (mathZero(len)) {
|
||||
_outlineMoveTo(*dash.outline, &dash.ptCur, transform);
|
||||
} else if (len < dash.curLen) {
|
||||
dash.curLen -= len;
|
||||
if (!dash.curOpGap) {
|
||||
if (dash.move) {
|
||||
|
@ -179,7 +181,9 @@ static void _dashCubicTo(SwDashStroke& dash, const Point* ctrl1, const Point* ct
|
|||
Bezier cur = {dash.ptCur, *ctrl1, *ctrl2, *to};
|
||||
auto len = bezLength(cur);
|
||||
|
||||
if (len < dash.curLen) {
|
||||
if (mathZero(len)) {
|
||||
_outlineMoveTo(*dash.outline, &dash.ptCur, transform);
|
||||
} else if (len < dash.curLen) {
|
||||
dash.curLen -= len;
|
||||
if (!dash.curOpGap) {
|
||||
if (dash.move) {
|
||||
|
|
Loading…
Add table
Reference in a new issue