aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2024-01-23 12:49:25 +0100
committerEirik Aavitsland <eirik.aavitsland@qt.io>2024-01-24 16:43:44 +0100
commitf932f8c86d35cb5ab52f21ec810893a429a3622c (patch)
tree698ea8ec03fa740e9d73ade9983b6bd25c409b05
parent7abc35acf850e35734a6873a34daff702eb56acc (diff)
Curverenderer: Simplify the workaround for 3 element paths
For a single triangle inner hull, qTriangulate() will sometimes give an unexpected result in the index list. Fix by overwriting it with the expected result, since that is static and known for this simple case. Pick-to: 6.7 Change-Id: I76d697f85f233b0c2ecc50da3074def89e860697 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r--src/quick/scenegraph/qsgcurveprocessor.cpp3
-rw-r--r--src/quick/scenegraph/util/qquadpath.cpp7
2 files changed, 3 insertions, 7 deletions
diff --git a/src/quick/scenegraph/qsgcurveprocessor.cpp b/src/quick/scenegraph/qsgcurveprocessor.cpp
index 57b248c520..012c7b0747 100644
--- a/src/quick/scenegraph/qsgcurveprocessor.cpp
+++ b/src/quick/scenegraph/qsgcurveprocessor.cpp
@@ -1684,6 +1684,9 @@ void QSGCurveProcessor::processFill(const QQuadPath &fillPath,
};
QTriangleSet triangles = qTriangulate(internalHull);
+ // Workaround issue in qTriangulate() for single-triangle path
+ if (triangles.indices.size() == 3)
+ triangles.indices.setDataUint({ 0, 1, 2 });
const quint32 *idxTable = static_cast<const quint32 *>(triangles.indices.data());
for (int triangle = 0; triangle < triangles.indices.size() / 3; ++triangle) {
diff --git a/src/quick/scenegraph/util/qquadpath.cpp b/src/quick/scenegraph/util/qquadpath.cpp
index eff2508d8f..5b63aa65ce 100644
--- a/src/quick/scenegraph/util/qquadpath.cpp
+++ b/src/quick/scenegraph/util/qquadpath.cpp
@@ -682,13 +682,6 @@ QQuadPath QQuadPath::subPathsClosed(bool *didClose) const
endElement.ep = m_elements[subStart].sp;
}
- // ### Workaround for triangulator issue: Avoid 3-element paths
- if (res.elementCount() == 3) {
- res.splitElementAt(2);
- res = res.flattened();
- Q_ASSERT(res.elementCount() == 4);
- }
-
if (didClose)
*didClose = closed;
return res;