aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2016-12-21 13:15:38 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2016-12-23 20:00:28 +0000
commit79831caa0533ad5f48322568557622596b85ed0f (patch)
treee5d0c4215fcd5df67d05b6a017a2cb7221f11754 /src/quick
parentbf7c6226264bd45095711b2c0556c42b6f267f72 (diff)
Treat 0 as a valid strokeWidth value
Use negative values as the trigger to disable stroking altogether. This matches both QPainter and NVPR better. Change-Id: I51395ae310fce8a8da0c06174eafa1dc17aae1db Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquickpathitem.cpp2
-rw-r--r--src/quick/items/qquickpathitemgenericrenderer.cpp6
-rw-r--r--src/quick/items/qquickpathitemgenericrenderer_p.h1
-rw-r--r--src/quick/items/qquickpathitemnvprrenderer.cpp2
4 files changed, 7 insertions, 4 deletions
diff --git a/src/quick/items/qquickpathitem.cpp b/src/quick/items/qquickpathitem.cpp
index 0d2c7a8bbe..720916c900 100644
--- a/src/quick/items/qquickpathitem.cpp
+++ b/src/quick/items/qquickpathitem.cpp
@@ -455,7 +455,7 @@ QSGNode *QQuickPathItemPrivate::createRenderNode()
return node;
const bool hasFill = fillColor != Qt::transparent;
- const bool hasStroke = !qFuzzyIsNull(strokeWidth) && strokeColor != Qt::transparent;
+ const bool hasStroke = strokeWidth >= 0.0f && strokeColor != Qt::transparent;
switch (ri->graphicsApi()) {
#ifndef QT_NO_OPENGL
diff --git a/src/quick/items/qquickpathitemgenericrenderer.cpp b/src/quick/items/qquickpathitemgenericrenderer.cpp
index 9bd03c0e51..4b15daef9a 100644
--- a/src/quick/items/qquickpathitemgenericrenderer.cpp
+++ b/src/quick/items/qquickpathitemgenericrenderer.cpp
@@ -145,7 +145,9 @@ void QQuickPathItemGenericRenderer::setStrokeColor(const QColor &color)
void QQuickPathItemGenericRenderer::setStrokeWidth(qreal w)
{
- m_pen.setWidthF(w);
+ m_strokeWidth = w;
+ if (w >= 0.0f)
+ m_pen.setWidthF(w);
m_syncDirty |= DirtyGeom;
}
@@ -311,7 +313,7 @@ void QQuickPathItemGenericRenderer::updatePathRenderNode()
m_effectiveDirty |= DirtyGeom;
}
- if (qFuzzyIsNull(m_pen.widthF()) || m_strokeColor.a == 0) {
+ if (m_strokeWidth < 0.0f || m_strokeColor.a == 0) {
delete m_rootNode->m_strokeNode;
m_rootNode->m_strokeNode = nullptr;
} else if (!m_rootNode->m_strokeNode) {
diff --git a/src/quick/items/qquickpathitemgenericrenderer_p.h b/src/quick/items/qquickpathitemgenericrenderer_p.h
index c186959c88..a094b9fca6 100644
--- a/src/quick/items/qquickpathitemgenericrenderer_p.h
+++ b/src/quick/items/qquickpathitemgenericrenderer_p.h
@@ -107,6 +107,7 @@ private:
QTriangulatingStroker m_stroker;
QDashedStrokeProcessor m_dashStroker;
+ float m_strokeWidth;
QPen m_pen;
Color4ub m_strokeColor;
Color4ub m_fillColor;
diff --git a/src/quick/items/qquickpathitemnvprrenderer.cpp b/src/quick/items/qquickpathitemnvprrenderer.cpp
index d07a63c86d..e0c458bfca 100644
--- a/src/quick/items/qquickpathitemnvprrenderer.cpp
+++ b/src/quick/items/qquickpathitemnvprrenderer.cpp
@@ -529,7 +529,7 @@ void QQuickPathItemNvprRenderNode::render(const RenderState *state)
nvpr.stencilThenCoverFillPath(m_path, m_fillRule, 0xFF, GL_BOUNDING_BOX_NV);
}
- if (!qFuzzyIsNull(m_strokeWidth) && !qFuzzyIsNull(m_strokeColor.w())) {
+ if (m_strokeWidth >= 0.0f && !qFuzzyIsNull(m_strokeColor.w())) {
if (m_fillGradientActive)
mtl = mtlmgr.activateMaterial(QQuickNvprMaterialManager::MatSolid);
f->glProgramUniform4f(mtl->prg, mtl->uniLoc[0],