Don't split bezier curves that are already just a line

Otherwise we can end up in an infinite loop of splitting the curve and
then discarding the half of the new curve, etc.

Fixes: QTBUG-74172
Change-Id: I1984b7fd33cd98f65866f1c57c6ab20114615803
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2019-03-04 14:32:09 +01:00
parent 28d0b987b7
commit 17a51c4e0d

View File

@ -333,7 +333,9 @@ static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qr
*shifted = QBezier::fromPoints(points_shifted[map[0]], points_shifted[map[1]], *shifted = QBezier::fromPoints(points_shifted[map[0]], points_shifted[map[1]],
points_shifted[map[2]], points_shifted[map[3]]); points_shifted[map[2]], points_shifted[map[3]]);
return good_offset(orig, shifted, offset, threshold); if (np > 2)
return good_offset(orig, shifted, offset, threshold);
return Ok;
} }
// This value is used to determine the length of control point vectors // This value is used to determine the length of control point vectors
@ -432,7 +434,6 @@ redo:
} else if (res == Ok) { } else if (res == Ok) {
++o; ++o;
--b; --b;
continue;
} else if (res == Circle && maxSegments - (o - curveSegments) >= 2) { } else if (res == Circle && maxSegments - (o - curveSegments) >= 2) {
// add semi circle // add semi circle
if (addCircle(b, offset, o)) if (addCircle(b, offset, o))