svg_engine: fix infinit loop dead in stroke rendering.

here logic was wrongly introducedd, we fix the condition check properly.

Change-Id: I97f18f68290c61096f4e7fe54bd6f6fde51e175b
This commit is contained in:
Hermet Park 2020-07-06 19:26:50 +09:00
parent 2929fa5c57
commit cfa17c6df6
3 changed files with 7 additions and 6 deletions

View file

@ -237,7 +237,7 @@ bool mathSmallCubic(SwPoint* base, SwFixed& angleIn, SwFixed& angleMid, SwFixed&
auto theta2 = abs(mathDiff(angleMid, angleOut));
if ((theta1 < (SW_ANGLE_PI / 8)) && (theta2 < (SW_ANGLE_PI / 8))) return true;
else return false;
return false;
}

View file

@ -648,7 +648,6 @@ bool shapeGenStrokeRle(SwShape& shape, const Shape* sdata, const SwSize& clip)
if (sdata->strokeDash(nullptr) > 0) {
shapeOutline = _genDashOutline(sdata);
if (!shapeOutline) return false;
//Normal Style stroke
} else {
if (!shape.outline) {

View file

@ -442,7 +442,7 @@ static void _cubicTo(SwStroke& stroke, const SwPoint& ctrl1, const SwPoint& ctrl
//initialize with current direction
angleIn = angleOut = angleMid = stroke.angleIn;
if (arc < limit && mathSmallCubic(arc, angleIn, angleMid, angleOut)) {
if (arc < limit && !mathSmallCubic(arc, angleIn, angleMid, angleOut)) {
if (stroke.firstPt) stroke.angleIn = angleIn;
mathSplitCubic(arc);
arc += 3;
@ -458,7 +458,7 @@ static void _cubicTo(SwStroke& stroke, const SwPoint& ctrl1, const SwPoint& ctrl
stroke.angleOut = angleIn;
_processCorner(stroke, 0);
}
} else if (abs(mathDiff(stroke.angleIn, angleIn)) > (SW_ANGLE_PI / 8)) {
} else if (abs(mathDiff(stroke.angleIn, angleIn)) > (SW_ANGLE_PI / 8) / 4) {
//if the deviation from one arc to the next is too great add a round corner
stroke.center = arc[3];
stroke.angleOut = angleIn;
@ -534,9 +534,11 @@ static void _cubicTo(SwStroke& stroke, const SwPoint& ctrl1, const SwPoint& ctrl
_borderLineTo(border, _end, false);
_borderCubicTo(border, _ctrl2, _ctrl1, _start);
//and thenmove to the endpoint
//and then move to the endpoint
_borderLineTo(border, _end, false);
++side;
++border;
continue;
}
@ -651,7 +653,7 @@ static void _addReverseLeft(SwStroke& stroke, bool opened)
static void _beginSubPath(SwStroke& stroke, SwPoint& to, bool opened)
{
/* We cannot process the first point because there is not enought
/* We cannot process the first point because there is not enough
information regarding its corner/cap. Later, it will be processed
in the _endSubPath() */