summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-08-07 08:30:35 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-08-07 08:35:47 (GMT)
commit7e2f40b8b98bab3cb5fd5343e496c3a268ce1c65 (patch)
treef2eb55d9d31df72c91db8d2c5371a89371fe1dff /src/gui/graphicsview
parent525f585465029075bace5f68997bea07e64f7725 (diff)
downloadQt-7e2f40b8b98bab3cb5fd5343e496c3a268ce1c65.zip
Qt-7e2f40b8b98bab3cb5fd5343e496c3a268ce1c65.tar.gz
Qt-7e2f40b8b98bab3cb5fd5343e496c3a268ce1c65.tar.bz2
Notify QGraphicsEffect whenever the source is invalidated.
In case of caching, the effect must be notified whenever the source has been invalidated; otherwise the cached pixmap will not be up-to-date. Auto-test included.
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp7
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h4
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h15
3 files changed, 21 insertions, 5 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 7a53598..6fe4477 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -4811,6 +4811,13 @@ void QGraphicsItem::update(const QRectF &rect)
if (rect.isEmpty() && !rect.isNull())
return;
+ // Make sure we notify effects about invalidated source.
+ QGraphicsItem *item = this;
+ do {
+ if (item->d_ptr->graphicsEffect)
+ item->d_ptr->notifyInvalidated = 1;
+ } while (item = item->d_ptr->parent);
+
if (CacheMode(d_ptr->cacheMode) != NoCache) {
QGraphicsItemCache *cache = d_ptr->extraItemCache();
if (d_ptr->discardUpdateRequest(/* ignoreVisibleBit = */ false,
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 0d6946f..310d9ef 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -165,6 +165,7 @@ public:
filtersDescendantEvents(0),
sceneTransformTranslateOnly(0),
notifyBoundingRectChanged(0),
+ notifyInvalidated(0),
globalStackingOrder(-1),
q_ptr(0)
{
@@ -459,7 +460,8 @@ public:
quint32 filtersDescendantEvents : 1;
quint32 sceneTransformTranslateOnly : 1;
quint32 notifyBoundingRectChanged : 1;
- quint32 unused : 5; // feel free to use
+ quint32 notifyInvalidated : 1;
+ quint32 unused : 4; // feel free to use
// Optional stacking order
int globalStackingOrder;
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index 0422124..64ee785 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -227,14 +227,21 @@ public:
item->d_ptr->fullUpdatePending = 0;
item->d_ptr->ignoreVisible = 0;
item->d_ptr->ignoreOpacity = 0;
- const bool notifyEffect = item->d_ptr->notifyBoundingRectChanged;
- item->d_ptr->notifyBoundingRectChanged = 0;
+ QGraphicsEffect::ChangeFlags flags;
+ if (item->d_ptr->notifyBoundingRectChanged) {
+ flags |= QGraphicsEffect::SourceBoundingRectChanged;
+ item->d_ptr->notifyBoundingRectChanged = 0;
+ }
+ if (item->d_ptr->notifyInvalidated) {
+ flags |= QGraphicsEffect::SourceInvalidated;
+ item->d_ptr->notifyInvalidated = 0;
+ }
if (recursive) {
for (int i = 0; i < item->d_ptr->children.size(); ++i)
resetDirtyItem(item->d_ptr->children.at(i), recursive);
}
- if (notifyEffect && item->d_ptr->graphicsEffect)
- item->d_ptr->graphicsEffect->sourceBoundingRectChanged();
+ if (flags && item->d_ptr->graphicsEffect)
+ item->d_ptr->graphicsEffect->sourceChanged(flags);
}
inline void ensureSortedTopLevelItems()