diff options
author | Andy Nichols <andy.nichols@theqtcompany.com> | 2016-06-27 13:30:05 +0200 |
---|---|---|
committer | Andy Nichols <andy.nichols@qt.io> | 2016-06-28 10:17:47 +0000 |
commit | 261675f8a404b6d19df72a7d6c3432cc58fbafe6 (patch) | |
tree | c1b03c1b6466b74588e5c23f16be555ca4e3711c /src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp | |
parent | a0aadc3226d99d6d950359383df596928f300001 (diff) |
Software Adaptation: Improve clip node handling
This commit solves two issues that were coming up with nested clip
nodes. The first was that determining the intersection of two or more
nested clip nodes was calculated incorrectly. This was fixed by making
sure the calculated clip region was in the correct coordinate space.
The second issue was because there was no distinction between an empty
unclipped region, and a completely clipped region. So a property was
added to specify when a RenderableNode had a clipRegion so that the
empty QRegion could be interpreted correctly. This makes sure that we
don't end up drawing nodes that were culled.
Change-Id: Id7af092f7fc6a4602b44b585b7dee14084136962
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp')
-rw-r--r-- | src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp index 7cfbc2dfda..385b257e44 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp @@ -58,6 +58,7 @@ QSGSoftwareRenderableNode::QSGSoftwareRenderableNode(NodeType type, QSGNode *nod : m_nodeType(type) , m_isOpaque(true) , m_isDirty(true) + , m_hasClipRegion(false) , m_opacity(1.0f) { switch (m_nodeType) { @@ -179,8 +180,12 @@ void QSGSoftwareRenderableNode::update() m_boundingRect = m_transform.mapRect(boundingRect); - if (m_clipRegion.rectCount() == 1) { - m_boundingRect = m_boundingRect.intersected(m_clipRegion.rects().first()); + if (m_hasClipRegion && m_clipRegion.rectCount() <= 1) { + // If there is a clipRegion, and it is empty, the item wont be rendered + if (m_clipRegion.isEmpty()) + m_boundingRect = QRect(); + else + m_boundingRect = m_boundingRect.intersected(m_clipRegion.rects().first()); } // Overrides @@ -284,12 +289,13 @@ void QSGSoftwareRenderableNode::setTransform(const QTransform &transform) update(); } -void QSGSoftwareRenderableNode::setClipRegion(const QRegion &clipRect) +void QSGSoftwareRenderableNode::setClipRegion(const QRegion &clipRect, bool hasClipRegion) { - if (m_clipRegion == clipRect) + if (m_clipRegion == clipRect && m_hasClipRegion == hasClipRegion) return; m_clipRegion = clipRect; + m_hasClipRegion = hasClipRegion; update(); } |