diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2024-04-02 14:20:04 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2024-04-03 23:08:44 +0200 |
commit | 1314d046f043bfcb29c44163e113b810c7764aed (patch) | |
tree | a5890de65756fe836c07ecf89c90a30a77220f1d /src/quick | |
parent | 15592b8bfef50ac5f4ce8ece5432475bb39fc463 (diff) |
Fix assert for certain dashed strokes in curve renderer
If the dashOffset was equal to the total length of the dash pattern,
certain pen widths could lead to an assert because of numerical
accuracy limitations. (fmod() would yield a remainder when dividing the
dashOffset by the pattern length sum, even though they should be equal).
Fixes: QTBUG-123805
Pick-to: 6.7
Change-Id: I17a4d5d39bcee128b893d3a7bef98c0816236ee4
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/scenegraph/util/qquadpath.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/scenegraph/util/qquadpath.cpp b/src/quick/scenegraph/util/qquadpath.cpp index 09286edb78..1f77cd0185 100644 --- a/src/quick/scenegraph/util/qquadpath.cpp +++ b/src/quick/scenegraph/util/qquadpath.cpp @@ -841,7 +841,7 @@ QQuadPath QQuadPath::dashed(qreal lineWidth, const QList<qreal> &dashPattern, qr for (float dashLength : pattern) { if (dashLength > startOffset) break; - startIndex++; + startIndex = (startIndex + 1) % pattern.size(); // The % guards against accuracy issues startOffset -= dashLength; } |