diff options
author | Abdiel Janulgue <abdiel.janulgue@nokia.com> | 2010-07-21 00:21:18 +0300 |
---|---|---|
committer | Abdiel Janulgue <abdiel.janulgue@nokia.com> | 2010-07-21 00:21:18 +0300 |
commit | ea02111b212af964e7d67ae4cb30d09367c1afcf (patch) | |
tree | e3ac9824668389c0271afa3145f25a8d81cad012 | |
parent | 606c567d57367a286a185ba703010c0679ceb01f (diff) |
Changes: Scene rendering optimizations. Only redraw textures in the scene which doesn't have
opaque areas above it
RevBy: TrustMe
-rw-r--r-- | src/mcompositescene.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/mcompositescene.cpp b/src/mcompositescene.cpp index b138c4f..36cb017 100644 --- a/src/mcompositescene.cpp +++ b/src/mcompositescene.cpp @@ -100,11 +100,19 @@ void MCompositeScene::drawItems(QPainter *painter, int numItems, QGraphicsItem * { for (int i = 0; i < numItems; ++i) { MCompositeWindow *window = (MCompositeWindow *) items[i]; - if (window->windowVisible() && !window->isIconified()) { - painter->save(); - painter->setMatrix(items[i]->sceneMatrix(), true); - items[i]->paint(painter, &options[i], widget); - painter->restore(); - } + + // Redraw only textures which don't have opaque textures above it + if (((i < numItems - 1) + && (items[i+1]->sceneMatrix().mapRect(items[i]->boundingRect()) == + items[i]->boundingRect()) + && (!((MCompositeWindow *)items[i+1])->propertyCache()->hasAlpha()) + && (((MCompositeWindow *)items[i+1])->opacity() == 1.0)) + || window->isIconified()) + continue; + + painter->save(); + painter->setMatrix(items[i]->sceneMatrix(), true); + items[i]->paint(painter, &options[i], widget); + painter->restore(); } } |