From 9e77d75a6286951783bab3f9c5fb98fd52f315b8 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Thu, 23 Nov 2017 12:19:08 +0100 Subject: Software Adaptation: Fix cliping logic error with empty clip regions The previous fix for nested clip regions introduced a regression which broke nested clipping cases that involved one of the clip nodes being null regions because they were offscreen. The clip region stack can either have an null QRegion or be empty as an initial state (depends on what is being rendered). We made a special check for these two states, but it is not enough to check if the top item is null for the null region case beacuse at any point in time a null clip region node could have been added. So to fix this the null initial state also requires a count of 1. Task-number: QTBUG-63743 Change-Id: Ib0d17026f1d5a663e819412e11d25d9ad8b445ff Reviewed-by: Laszlo Agocs --- .../adaptations/software/qsgsoftwarerenderablenodeupdater.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp index 666f1d0616..fabecfcbb8 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp @@ -83,7 +83,7 @@ void QSGSoftwareRenderableNodeUpdater::endVisit(QSGTransformNode *) bool QSGSoftwareRenderableNodeUpdater::visit(QSGClipNode *node) { // Make sure to translate the clip rect into world coordinates - if (m_clipState.count() == 0 || m_clipState.top().isNull()) { + if (m_clipState.count() == 0 || (m_clipState.count() == 1 && m_clipState.top().isNull())) { m_clipState.push(m_transformState.top().map(QRegion(node->clipRect().toRect()))); m_hasClip = true; } else { @@ -97,7 +97,7 @@ bool QSGSoftwareRenderableNodeUpdater::visit(QSGClipNode *node) void QSGSoftwareRenderableNodeUpdater::endVisit(QSGClipNode *) { m_clipState.pop(); - if (m_clipState.count() == 0 || m_clipState.top().isNull()) + if (m_clipState.count() == 0 || (m_clipState.count() == 1 && m_clipState.top().isNull())) m_hasClip = false; } -- cgit v1.2.3