aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@qt.io>2024-12-16 14:45:11 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2025-01-06 09:58:06 +0000
commitec2a2dd1b21cf182f4ad1b3f3d8920471f8f90ac (patch)
treed914da1193e6d816448d708d2a0709f5e9f18843
parent8d4c968f61454d835a2743275e72ca1f9f752ca1 (diff)
Software Renderer: Ensure flushing of previously dirty regions
Previously, if an opaque item was moved completely behind another opaque item between frames, the previous region occupied by the item might not be flushed. This occurred because, when subtracting the obscured region from the node’s dirty region, the dirty region could become empty. In such cases, the node would mark itself as no longer dirty, resulting in no flushing for the next frame. This could cause the old position of the item not to be cleared properly. To address this issue, additional logic has been added to ensure that the previous dirty region is still flushed, even in this edge case. Fixes: QTBUG-132192 Pick-to: 6.5 Change-Id: Iad45ddeeb65e70090e8368d94245b13692017fd1 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 6f653fff7f6865a35c89f4163713134ff7a2b26e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit f5760123c7d11369a3b666287fd4537d67f6793e)
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
index c9385630d9..bf195a90b3 100644
--- a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
@@ -123,6 +123,10 @@ QRegion QSGAbstractSoftwareRenderer::optimizeRenderList()
// Objective is to update the dirty status and rects.
for (auto i = m_renderableNodes.rbegin(); i != m_renderableNodes.rend(); ++i) {
auto node = *i;
+ // Track the original version of isDirty() as it can change if
+ // when we subtract dirty regions but still need to mark the previously
+ // dirty region as dirty.
+ const bool wasDirty = node->isDirty();
if (!m_dirtyRegion.isEmpty()) {
// See if the current dirty regions apply to the current node
node->addDirtyRegion(m_dirtyRegion, true);
@@ -156,7 +160,11 @@ QRegion QSGAbstractSoftwareRenderer::optimizeRenderList()
// if isAlpha, add node's dirty rect to m_dirtyRegion
m_dirtyRegion += node->dirtyRegion();
}
- // if previousDirtyRegion has content outside of boundingRect add to m_dirtyRegion
+ }
+
+ if (wasDirty) {
+ // If this node started out dirty, make sure its previous region is
+ // added to the dirty region so that it gets cleared properly.
QRegion prevDirty = node->previousDirtyRegion();
if (!prevDirty.isNull())
m_dirtyRegion += prevDirty;