summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-06-17 18:35:25 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-06-17 18:35:25 (GMT)
commit08c80cc1bc50f9f2990f0fc459f09d2b554bce08 (patch)
tree889c9000d5fcd2604ca27b8719d5545a855df12b
parent2b7765b82720e844ec815d3f4fe84cd59624576e (diff)
downloadQt-08c80cc1bc50f9f2990f0fc459f09d2b554bce08.zip
Qt-08c80cc1bc50f9f2990f0fc459f09d2b554bce08.tar.gz
Qt-08c80cc1bc50f9f2990f0fc459f09d2b554bce08.tar.bz2
Speedup QGraphicsScenePrivate::processDirtyItemsRecursive
Don't calculate dirty scene transforms for invisible items.
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index e89d80f..7dbe6d9 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -5307,24 +5307,27 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
{
Q_Q(QGraphicsScene);
- // Calculate the full scene transform for this item.
- bool wasDirtyParentSceneTransform = false;
- if (item && item->d_ptr->dirtySceneTransform && !item->d_ptr->itemIsUntransformable()) {
- item->d_ptr->sceneTransform = item->d_ptr->parent ? item->d_ptr->parent->d_ptr->sceneTransform
- : QTransform();
- item->d_ptr->combineTransformFromParent(&item->d_ptr->sceneTransform);
- item->d_ptr->dirtySceneTransform = 0;
- wasDirtyParentSceneTransform = true;
- }
-
bool wasDirtyParentViewBoundingRects = false;
+ bool wasDirtyParentSceneTransform = false;
qreal opacity = parentOpacity;
+
if (item) {
wasDirtyParentViewBoundingRects = item->d_ptr->paintedViewBoundingRectsNeedRepaint;
opacity = item->d_ptr->combineOpacityFromParent(parentOpacity);
- if ((!item->d_ptr->ignoreVisible && !item->d_ptr->visible)
- || (!item->d_ptr->ignoreOpacity && opacity == 0.0)
- || (item->d_ptr->flags & QGraphicsItem::ItemHasNoContents)) {
+ const bool itemIsHidden = !item->d_ptr->ignoreVisible && !item->d_ptr->visible;
+ const bool itemIsFullyTransparent = !item->d_ptr->ignoreOpacity && opacity == 0.0;
+
+ if (item->d_ptr->dirtySceneTransform && !itemIsHidden && !item->d_ptr->itemIsUntransformable()
+ && !(itemIsFullyTransparent && item->d_ptr->childrenCombineOpacity())) {
+ // Calculate the full scene transform for this item.
+ item->d_ptr->sceneTransform = item->d_ptr->parent ? item->d_ptr->parent->d_ptr->sceneTransform
+ : QTransform();
+ item->d_ptr->combineTransformFromParent(&item->d_ptr->sceneTransform);
+ item->d_ptr->dirtySceneTransform = 0;
+ wasDirtyParentSceneTransform = true;
+ }
+
+ if (itemIsHidden || itemIsFullyTransparent || (item->d_ptr->flags & QGraphicsItem::ItemHasNoContents)) {
// Make sure we don't process invisible items or items with no content.
item->d_ptr->dirty = 0;
item->d_ptr->paintedViewBoundingRectsNeedRepaint = 0;