mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 20:14:37 +00:00
sw_engine: fixing stroke outline
In the case of non-uniform scaling for thick strokes, artifacts were visible. The calculations took into account the angle resulting from the already transformed points, whereas the untransformed points should have been considered - the transformation is taken into account in the next step. @issue: https://github.com/thorvg/thorvg/issues/1915
This commit is contained in:
parent
b150d71912
commit
6377257f8c
1 changed files with 1 additions and 3 deletions
|
@ -377,9 +377,6 @@ static void _lineTo(SwStroke& stroke, const SwPoint& to)
|
||||||
//a zero-length lineto is a no-op; avoid creating a spurious corner
|
//a zero-length lineto is a no-op; avoid creating a spurious corner
|
||||||
if (delta.zero()) return;
|
if (delta.zero()) return;
|
||||||
|
|
||||||
//compute length of line
|
|
||||||
auto angle = mathAtan(delta);
|
|
||||||
|
|
||||||
/* The lineLength is used to determine the intersection of strokes outlines.
|
/* The lineLength is used to determine the intersection of strokes outlines.
|
||||||
The scale needs to be reverted since the stroke width has not been scaled.
|
The scale needs to be reverted since the stroke width has not been scaled.
|
||||||
An alternative option is to scale the width of the stroke properly by
|
An alternative option is to scale the width of the stroke properly by
|
||||||
|
@ -387,6 +384,7 @@ static void _lineTo(SwStroke& stroke, const SwPoint& to)
|
||||||
delta.x = static_cast<SwCoord>(delta.x / stroke.sx);
|
delta.x = static_cast<SwCoord>(delta.x / stroke.sx);
|
||||||
delta.y = static_cast<SwCoord>(delta.y / stroke.sy);
|
delta.y = static_cast<SwCoord>(delta.y / stroke.sy);
|
||||||
auto lineLength = mathLength(delta);
|
auto lineLength = mathLength(delta);
|
||||||
|
auto angle = mathAtan(delta);
|
||||||
|
|
||||||
delta = {static_cast<SwCoord>(stroke.width), 0};
|
delta = {static_cast<SwCoord>(stroke.width), 0};
|
||||||
mathRotate(delta, angle + SW_ANGLE_PI2);
|
mathRotate(delta, angle + SW_ANGLE_PI2);
|
||||||
|
|
Loading…
Add table
Reference in a new issue