diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-01-10 17:17:11 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-01-23 13:56:20 +0000 |
commit | 77614c6c48ce8caf5697afb53a26caf1b165fed3 (patch) | |
tree | c7dd0aec08dd16c1d9821fda8b9242f80ea29ee7 /src/quick/items | |
parent | 20c2c8b627b119b9ed72dd40f5b1f77786fad1de (diff) |
Correct software PathItem bounding rect
Reporting the QQuickItem geometry is incorrect. Report the area touched
by the path instead. This fixes the tiger in the pathitem example.
Change-Id: Ib443f442411befabe7864eff6473604926527f4e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/items')
-rw-r--r-- | src/quick/items/qquickpathitemsoftwarerenderer.cpp | 9 | ||||
-rw-r--r-- | src/quick/items/qquickpathitemsoftwarerenderer_p.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/quick/items/qquickpathitemsoftwarerenderer.cpp b/src/quick/items/qquickpathitemsoftwarerenderer.cpp index 63d4f8f6d4..46ebcbfe6d 100644 --- a/src/quick/items/qquickpathitemsoftwarerenderer.cpp +++ b/src/quick/items/qquickpathitemsoftwarerenderer.cpp @@ -180,6 +180,8 @@ void QQuickPathItemSoftwareRenderer::updateNode() if (listChanged) m_node->m_vp.resize(count); + m_node->m_boundingRect = QRectF(); + for (int i = 0; i < count; ++i) { VisualPathGuiData &src(m_vp[i]); QQuickPathItemSoftwareRenderNode::VisualPathRenderData &dst(m_node->m_vp[i]); @@ -201,6 +203,11 @@ void QQuickPathItemSoftwareRenderer::updateNode() dst.brush = src.brush; src.dirty = 0; + + QRectF br = dst.path.boundingRect(); + const float sw = qMax(1.0f, dst.strokeWidth); + br.adjust(-sw, -sw, sw, sw); + m_node->m_boundingRect |= br; } m_node->markDirty(QSGNode::DirtyMaterial); @@ -256,7 +263,7 @@ QSGRenderNode::RenderingFlags QQuickPathItemSoftwareRenderNode::flags() const QRectF QQuickPathItemSoftwareRenderNode::rect() const { - return QRect(0, 0, m_item->width(), m_item->height()); + return m_boundingRect; } QT_END_NAMESPACE diff --git a/src/quick/items/qquickpathitemsoftwarerenderer_p.h b/src/quick/items/qquickpathitemsoftwarerenderer_p.h index 38130d7301..64280b436e 100644 --- a/src/quick/items/qquickpathitemsoftwarerenderer_p.h +++ b/src/quick/items/qquickpathitemsoftwarerenderer_p.h @@ -125,6 +125,7 @@ private: QBrush brush; }; QVector<VisualPathRenderData> m_vp; + QRectF m_boundingRect; friend class QQuickPathItemSoftwareRenderer; }; |