Painting: Avoid endless loop for certain bezier curves

If the coordinates were too close (at the limit of the number
accuracy), the splitting algorithm in QBezier::shifted() would never
finish. Ref. testcase in bugreport.

Task-number: QTBUG-44674
Change-Id: I2a575cdc6284504ef5e3eb2b749857576fe433c3
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
Eirik Aavitsland 2015-03-03 14:44:46 +01:00 committed by aavit
parent 96e9b41e25
commit 88550543f8

View File

@ -402,8 +402,8 @@ int QBezier::shifted(QBezier *curveSegments, int maxSegments, qreal offset, floa
Q_ASSERT(curveSegments); Q_ASSERT(curveSegments);
Q_ASSERT(maxSegments > 0); Q_ASSERT(maxSegments > 0);
if (x1 == x2 && x1 == x3 && x1 == x4 && if (qFuzzyCompare(x1, x2) && qFuzzyCompare(x1, x3) && qFuzzyCompare(x1, x4) &&
y1 == y2 && y1 == y3 && y1 == y4) qFuzzyCompare(y1, y2) && qFuzzyCompare(y1, y3) && qFuzzyCompare(y1, y4))
return 0; return 0;
--maxSegments; --maxSegments;