From 17a51c4e0d0a4c16b800b7d932961c017ed2ea3a Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 4 Mar 2019 14:32:09 +0100 Subject: 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 --- src/gui/painting/qbezier.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/gui/painting/qbezier.cpp') diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index a3dcb02e07..ddd1d997f2 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -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]], 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 @@ -432,7 +434,6 @@ redo: } else if (res == Ok) { ++o; --b; - continue; } else if (res == Circle && maxSegments - (o - curveSegments) >= 2) { // add semi circle if (addCircle(b, offset, o)) -- cgit v1.2.3