summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-06-16 07:40:41 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-06-16 07:41:44 (GMT)
commit36ff1b507bf2d509019ae8ddd638922b09755c6b (patch)
treedac4142ca4293c9cd31a3b3b517c39fdf5dfaff3 /src
parentd9308550f104526d29b1cdd56514ae3bb967d7f9 (diff)
downloadQt-36ff1b507bf2d509019ae8ddd638922b09755c6b.zip
Qt-36ff1b507bf2d509019ae8ddd638922b09755c6b.tar.gz
Qt-36ff1b507bf2d509019ae8ddd638922b09755c6b.tar.bz2
Early exit from QRegion::intersects() if there is only one rect.
Don't waste cycles with constructing two vectors with rectangles if there is only one rectangle in each of the two regions. Reviewed-by: Lars Reviewed-by: bnilsen
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qregion.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index c4cd77a..946d880 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -698,6 +698,8 @@ bool QRegion::intersects(const QRegion &region) const
if (!rect_intersects(boundingRect(), region.boundingRect()))
return false;
+ if (numRects() == 1 && region.numRects() == 1)
+ return true;
const QVector<QRect> myRects = rects();
const QVector<QRect> otherRects = region.rects();