mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
sw_engine: hotfix a regression bug of line drawing.
fixed one more corner case problem, just observed.
it's a side effect by 925009c4a5
This commit is contained in:
parent
e8e9ba5ea0
commit
c503f688db
1 changed files with 13 additions and 4 deletions
|
@ -28,10 +28,19 @@
|
||||||
/* Internal Class Implementation */
|
/* Internal Class Implementation */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
|
static bool _outlineBegin(SwOutline& outline)
|
||||||
|
{
|
||||||
|
//Make a contour if lineTo/curveTo without calling close or moveTo beforehand.
|
||||||
|
if (outline.pts.empty()) return false;
|
||||||
|
outline.cntrs.push(outline.pts.count - 1);
|
||||||
|
outline.pts.push(outline.pts[outline.cntrs.last()]);
|
||||||
|
outline.types.push(SW_CURVE_TYPE_POINT);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool _outlineEnd(SwOutline& outline)
|
static bool _outlineEnd(SwOutline& outline)
|
||||||
{
|
{
|
||||||
//Make a contour if lineTo/curveTo without calling close/moveTo beforehand.
|
|
||||||
if (outline.pts.empty()) return false;
|
if (outline.pts.empty()) return false;
|
||||||
outline.cntrs.push(outline.pts.count - 1);
|
outline.cntrs.push(outline.pts.count - 1);
|
||||||
outline.closed.push(false);
|
outline.closed.push(false);
|
||||||
|
@ -402,7 +411,7 @@ static bool _genOutline(SwShape* shape, const RenderShape* rshape, const Matrix*
|
||||||
|
|
||||||
shape->outline = mpoolReqOutline(mpool, tid);
|
shape->outline = mpoolReqOutline(mpool, tid);
|
||||||
auto outline = shape->outline;
|
auto outline = shape->outline;
|
||||||
bool closed = false;
|
auto closed = false;
|
||||||
|
|
||||||
//Generate Outlines
|
//Generate Outlines
|
||||||
while (cmdCnt-- > 0) {
|
while (cmdCnt-- > 0) {
|
||||||
|
@ -417,13 +426,13 @@ static bool _genOutline(SwShape* shape, const RenderShape* rshape, const Matrix*
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PathCommand::LineTo: {
|
case PathCommand::LineTo: {
|
||||||
if (closed) closed = _outlineEnd(*outline);
|
if (closed) closed = _outlineBegin(*outline);
|
||||||
_outlineLineTo(*outline, pts, transform);
|
_outlineLineTo(*outline, pts, transform);
|
||||||
++pts;
|
++pts;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PathCommand::CubicTo: {
|
case PathCommand::CubicTo: {
|
||||||
if (closed) closed = _outlineEnd(*outline);
|
if (closed) closed = _outlineBegin(*outline);
|
||||||
_outlineCubicTo(*outline, pts, pts + 1, pts + 2, transform);
|
_outlineCubicTo(*outline, pts, pts + 1, pts + 2, transform);
|
||||||
pts += 3;
|
pts += 3;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue