diff options
author | Andy Nichols <andy.nichols@theqtcompany.com> | 2016-04-13 15:30:09 +0200 |
---|---|---|
committer | Andy Nichols <andy.nichols@theqtcompany.com> | 2016-04-13 14:18:07 +0000 |
commit | bdfd88d097c56871decf4a5ff3e7053290b067aa (patch) | |
tree | 02e57d4f87d0af1bcfbbb75d69a8bdd6e1bd3f9a | |
parent | 49f715f9f0b777d47de89f600199fe297c89a9c6 (diff) |
2DRenderer: Mark all regions of deleted node as dirty
Previous behavior was to always subtract the current bounding rect of
items when calculating the previous dirty region. When you remove a
node though, there is no current bounding rect because the item no
longer exists. The last valid boundingRect was use instead, which led
to the previous bounding rect to not get marked as dirty when the node
was removed.
Change-Id: Ic1a4f872d4d46125b06e2588aae695b8ff67d0fd
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
3 files changed, 8 insertions, 3 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp index 4ceaa08197..eb0e26462a 100644 --- a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp @@ -260,7 +260,7 @@ void QSGAbstractSoftwareRenderer::nodeRemoved(QSGNode *node) // remove mapping if (renderable != nullptr) { // Need to mark this region dirty in the other nodes - QRegion dirtyRegion = renderable->previousDirtyRegion(); + QRegion dirtyRegion = renderable->previousDirtyRegion(true); if (dirtyRegion.isEmpty()) dirtyRegion = renderable->boundingRect(); m_dirtyRegion += dirtyRegion; diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp index 65cce805a4..063242c63b 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp @@ -310,8 +310,13 @@ void QSGSoftwareRenderableNode::subtractDirtyRegion(const QRegion &dirtyRegion) qCDebug(lcRenderable) << "subtractDirtyRegion: " << dirtyRegion << "old dirtyRegion" << prev << "new dirtyRegion: " << m_dirtyRegion; } -QRegion QSGSoftwareRenderableNode::previousDirtyRegion() const +QRegion QSGSoftwareRenderableNode::previousDirtyRegion(bool wasRemoved) const { + // When removing a node, the boundingRect shouldn't be subtracted + // because a deleted node has no valid boundingRect + if (wasRemoved) + return m_previousDirtyRegion; + return m_previousDirtyRegion.subtracted(QRegion(m_boundingRect)); } diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h index 67f28e115d..9a5e0a5683 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h @@ -105,7 +105,7 @@ public: void addDirtyRegion(const QRegion &dirtyRegion, bool forceDirty = true); void subtractDirtyRegion(const QRegion &dirtyRegion); - QRegion previousDirtyRegion() const; + QRegion previousDirtyRegion(bool wasRemoved = false) const; QRegion dirtyRegion() const; private: |