summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Erik Nilsen <bnilsen@trolltech.com>2009-02-26 13:49:47 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-04-06 11:37:38 (GMT)
commitbe6be8c73929f2ddee9a02f59db05c3ba453a63e (patch)
tree85ff724aeed809922b1a985f5cd44dd57087a3a3
parente27743bdeda7aa3cb42f2d81a521121f8ee04eae (diff)
downloadQt-be6be8c73929f2ddee9a02f59db05c3ba453a63e.zip
Qt-be6be8c73929f2ddee9a02f59db05c3ba453a63e.tar.gz
Qt-be6be8c73929f2ddee9a02f59db05c3ba453a63e.tar.bz2
Fixes: Optimize QGraphicsViewPrivate::updateRect()/updateRegion().
Details: Those cut-offs are extremely important. After few seconds interaction with the iphone demo, updateRect() was called approx. 3000 times with an empty rect. Then imagine what happens when having e.g. FullViewportUpdate. We do q->viewport()->update() JUST FOR FUN!
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 9b0e12d..aa5f069 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -928,6 +928,9 @@ void QGraphicsViewPrivate::updateAll()
void QGraphicsViewPrivate::updateRegion(const QRegion &r)
{
+ if (r.isEmpty())
+ return;
+
Q_Q(QGraphicsView);
// Rect intersects viewport - update everything?
@@ -976,6 +979,9 @@ void QGraphicsViewPrivate::updateRegion(const QRegion &r)
void QGraphicsViewPrivate::updateRect(const QRect &r)
{
+ if (r.isEmpty())
+ return;
+
Q_Q(QGraphicsView);
// Rect intersects viewport - update everything?