diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-04-12 15:25:40 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-04-28 07:58:25 +0000 |
commit | 82c06fb0f545f379e088cf24929fcf954686c5c2 (patch) | |
tree | 86b78d51deaf4fe0076ad7b95dc6e12f364e8126 /src | |
parent | 851b39a6d675552e2fc70c75652ffc04bcc1a2ed (diff) |
Fix return of empty paths with multiple points on intersections
The intersection algorithm for intersection with rects, might return
one edge of the rect even if that edge does not intersect with the path.
To deal with that we collapse paths with empty bounding rects to the empty path.
Task-number: QTBUG-60024
Change-Id: I3e305983c66548e772d7d7ce3de99d715edbdd1b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qpathclipper.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index addd9c0c2c..924d332452 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -2096,7 +2096,12 @@ QPainterPath intersectPath(const QPainterPath &path, const QRectF &rect) result.addPath(subPath); } } - return result; + // The algorithm above might return one side of \a rect if there was no intersection, + // so only return intersections that are not empty rectangles. + if (result.boundingRect().isEmpty()) + return QPainterPath(); + else + return result; } } |