diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-01-04 14:14:04 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-01-10 14:47:34 +0000 |
commit | 917a9382df8a5a673556a21b1b46e4343231d674 (patch) | |
tree | 9aa950a2c3ffe0cb0aea7622d7666ddcbc544639 /src/quick | |
parent | aa24b8938bb03e688633e544dddeca5aff91940e (diff) |
Fix negative stroke width for software PathItem
Like the generic one, this also needs to deal with the fact that
QPen does not take negative widths. Store the value separately.
Change-Id: Ia332c2d83e98c03125a05c838cb8184346f8303a
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquickpathitemsoftwarerenderer.cpp | 10 | ||||
-rw-r--r-- | src/quick/items/qquickpathitemsoftwarerenderer_p.h | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/quick/items/qquickpathitemsoftwarerenderer.cpp b/src/quick/items/qquickpathitemsoftwarerenderer.cpp index f089904fdf..c7b52e641f 100644 --- a/src/quick/items/qquickpathitemsoftwarerenderer.cpp +++ b/src/quick/items/qquickpathitemsoftwarerenderer.cpp @@ -61,7 +61,9 @@ void QQuickPathItemSoftwareRenderer::setStrokeColor(const QColor &color) void QQuickPathItemSoftwareRenderer::setStrokeWidth(qreal w) { - m_pen.setWidthF(w); + m_strokeWidth = w; + if (w >= 0.0f) + m_pen.setWidthF(w); m_dirty |= DirtyPen; } @@ -169,8 +171,10 @@ void QQuickPathItemSoftwareRenderer::updatePathRenderNode() if (m_dirty & DirtyFillRule) m_node->m_path.setFillRule(m_fillRule); - if (m_dirty & DirtyPen) + if (m_dirty & DirtyPen) { m_node->m_pen = m_pen; + m_node->m_strokeWidth = m_strokeWidth; + } if (m_dirty & DirtyBrush) m_node->m_brush = m_brush; @@ -209,7 +213,7 @@ void QQuickPathItemSoftwareRenderNode::render(const RenderState *state) p->setTransform(matrix()->toTransform()); p->setOpacity(inheritedOpacity()); - p->setPen(!qFuzzyIsNull(m_pen.widthF()) && m_pen.color() != Qt::transparent ? m_pen : Qt::NoPen); + p->setPen(m_strokeWidth >= 0.0f && m_pen.color() != Qt::transparent ? m_pen : Qt::NoPen); p->setBrush(m_brush.color() != Qt::transparent ? m_brush : Qt::NoBrush); p->drawPath(m_path); diff --git a/src/quick/items/qquickpathitemsoftwarerenderer_p.h b/src/quick/items/qquickpathitemsoftwarerenderer_p.h index 584771425d..6c7d052596 100644 --- a/src/quick/items/qquickpathitemsoftwarerenderer_p.h +++ b/src/quick/items/qquickpathitemsoftwarerenderer_p.h @@ -94,6 +94,7 @@ private: QPainterPath m_path; QPen m_pen; + float m_strokeWidth; QColor m_fillColor; QBrush m_brush; Qt::FillRule m_fillRule; @@ -117,6 +118,7 @@ private: QPainterPath m_path; QPen m_pen; + float m_strokeWidth; QBrush m_brush; friend class QQuickPathItemSoftwareRenderer; |