From 36ff1b507bf2d509019ae8ddd638922b09755c6b Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Tue, 16 Jun 2009 09:40:41 +0200 Subject: 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 --- src/gui/painting/qregion.cpp | 2 ++ 1 file changed, 2 insertions(+) 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 ®ion) const if (!rect_intersects(boundingRect(), region.boundingRect())) return false; + if (numRects() == 1 && region.numRects() == 1) + return true; const QVector myRects = rects(); const QVector otherRects = region.rects(); -- cgit v0.12