summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qbezier.cpp
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@theqtcompany.com>2015-03-03 14:44:46 +0100
committeraavit <eirik.aavitsland@theqtcompany.com>2015-03-04 09:18:24 +0000
commit88550543f8b4b7c76bffeebb923ad1f72b774b6e (patch)
tree22435c586e69936db23117abed6fdf19c1603756 /src/gui/painting/qbezier.cpp
parent96e9b41e254aaeff2e1bb320791fa6e19f179e2b (diff)
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>
Diffstat (limited to 'src/gui/painting/qbezier.cpp')
-rw-r--r--src/gui/painting/qbezier.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp
index 90240d1752..a741c94c16 100644
--- a/src/gui/painting/qbezier.cpp
+++ b/src/gui/painting/qbezier.cpp
@@ -402,8 +402,8 @@ int QBezier::shifted(QBezier *curveSegments, int maxSegments, qreal offset, floa
Q_ASSERT(curveSegments);
Q_ASSERT(maxSegments > 0);
- if (x1 == x2 && x1 == x3 && x1 == x4 &&
- y1 == y2 && y1 == y3 && y1 == y4)
+ if (qFuzzyCompare(x1, x2) && qFuzzyCompare(x1, x3) && qFuzzyCompare(x1, x4) &&
+ qFuzzyCompare(y1, y2) && qFuzzyCompare(y1, y3) && qFuzzyCompare(y1, y4))
return 0;
--maxSegments;