diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-16 07:51:09 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-16 07:51:09 (GMT) |
commit | ea83669b9b44b1fb3a5acae6d53afd1df401e9b5 (patch) | |
tree | c7173a3ca0244c0df95453b950c380cfb34ae0ac /src/gui/graphicsview | |
parent | 6952f867c6f506b89ca807fa986198f022ab0926 (diff) | |
download | Qt-ea83669b9b44b1fb3a5acae6d53afd1df401e9b5.zip Qt-ea83669b9b44b1fb3a5acae6d53afd1df401e9b5.tar.gz Qt-ea83669b9b44b1fb3a5acae6d53afd1df401e9b5.tar.bz2 |
Don't mark ItemHasNoContents items as dirty, ever.
The QGraphicsItem::ItemHasNoContents flag ensures that we don't have
to ever paint this item. So let's not mark it as dirty at all (items
are marked as dirty when updated, moved, or transformed).
This is a minor optimization.
Reviewed-by: bnilsen
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 38a1abe..1340adf 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5282,11 +5282,14 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b return; } - item->d_ptr->dirty = 1; - if (fullItemUpdate) - item->d_ptr->fullUpdatePending = 1; - else if (!item->d_ptr->fullUpdatePending) - item->d_ptr->needsRepaint |= rect; + bool hasNoContents = item->d_ptr->flags & QGraphicsItem::ItemHasNoContents; + if (!hasNoContents) { + item->d_ptr->dirty = 1; + if (fullItemUpdate) + item->d_ptr->fullUpdatePending = 1; + else if (!item->d_ptr->fullUpdatePending) + item->d_ptr->needsRepaint |= rect; + } if (invalidateChildren) { item->d_ptr->allChildrenDirty = 1; |