aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <[email protected]>2025-06-23 15:34:28 +0200
committerEskil Abrahamsen Blomfeldt <[email protected]>2025-06-24 01:32:49 +0200
commit111a96dcdf6f80a1cb11c4d0556fb2adcd40ae27 (patch)
treeae3d5c65a870c7f224c3b5f1a3e35b5a8d07635b
parentf84f10259afb2f8c1e96e29b625d0702bc172b80 (diff)
CurveRenderer: Don't spend time populating unused listHEADdev
When the debug wireframe is disabled, we would still populate the wireframe vertices, even though these are never read. This shows up as a small hotspot in valgrind and skipping it gives a small performance improvement. Pick-to: 6.10 Change-Id: I51ef403f088154a99c7335356655d3f2cc17b4de Reviewed-by: Eirik Aavitsland <[email protected]>
-rw-r--r--src/quickshapes/qquickshapecurverenderer.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/quickshapes/qquickshapecurverenderer.cpp b/src/quickshapes/qquickshapecurverenderer.cpp
index 760224d21e..eefe9da169 100644
--- a/src/quickshapes/qquickshapecurverenderer.cpp
+++ b/src/quickshapes/qquickshapecurverenderer.cpp
@@ -763,12 +763,13 @@ QQuickShapeCurveRenderer::NodeList QQuickShapeCurveRenderer::addCurveStrokeNodes
static const int subdivisions = qEnvironmentVariable("QT_QUICKSHAPES_STROKE_SUBDIVISIONS", QStringLiteral("3")).toInt();
+ const bool wireFrame = debugVisualization() & DebugWireframe;
QSGCurveProcessor::processStroke(path,
pen.miterLimit(),
penWidth,
pen.joinStyle(),
pen.capStyle(),
- [&wfVertices, &node](const std::array<QVector2D, 3> &s,
+ [&wfVertices, &node, &wireFrame](const std::array<QVector2D, 3> &s,
const std::array<QVector2D, 3> &p,
const std::array<QVector2D, 3> &n,
QSGCurveStrokeNode::TriangleFlags flags)
@@ -781,9 +782,11 @@ QQuickShapeCurveRenderer::NodeList QQuickShapeCurveRenderer::addCurveStrokeNodes
else
node->appendTriangle(s, p, n);
- wfVertices.append({p0.x(), p0.y(), 1.0f, 0.0f, 0.0f});
- wfVertices.append({p1.x(), p1.y(), 0.0f, 1.0f, 0.0f});
- wfVertices.append({p2.x(), p2.y(), 0.0f, 0.0f, 1.0f});
+ if (Q_UNLIKELY(wireFrame)) {
+ wfVertices.append({p0.x(), p0.y(), 1.0f, 0.0f, 0.0f});
+ wfVertices.append({p1.x(), p1.y(), 0.0f, 1.0f, 0.0f});
+ wfVertices.append({p2.x(), p2.y(), 0.0f, 0.0f, 1.0f});
+ }
},
subdivisions);
@@ -794,8 +797,7 @@ QQuickShapeCurveRenderer::NodeList QQuickShapeCurveRenderer::addCurveStrokeNodes
node->cookGeometry();
ret.append(node);
- const bool wireFrame = debugVisualization() & DebugWireframe;
- if (wireFrame) {
+ if (Q_UNLIKELY(wireFrame)) {
QQuickShapeWireFrameNode *wfNode = new QQuickShapeWireFrameNode;
QSGGeometry *wfg = new QSGGeometry(QQuickShapeWireFrameNode::attributes(),