diff options
Diffstat (limited to 'src/quick/util/qquicksvgparser.cpp')
| -rw-r--r-- | src/quick/util/qquicksvgparser.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/quick/util/qquicksvgparser.cpp b/src/quick/util/qquicksvgparser.cpp index 5f88805ef7..8cca5addbb 100644 --- a/src/quick/util/qquicksvgparser.cpp +++ b/src/quick/util/qquicksvgparser.cpp @@ -159,6 +159,10 @@ void QQuickSvgParser::pathArc(QPainterPath &path, qreal y, qreal curx, qreal cury) { + // Check if the start point is equal to the end point. + if (QPointF(curx, cury) == QPointF(x, y)) + return; + qreal sin_th, cos_th; qreal a00, a01, a10, a11; qreal x0, y0, x1, y1, xc, yc; @@ -169,6 +173,14 @@ void QQuickSvgParser::pathArc(QPainterPath &path, rx = qAbs(rx); ry = qAbs(ry); + // Avoid nans and division by zero. + if (qFuzzyIsNull(rx) || qFuzzyIsNull(ry)) { + // https://www.w3.org/TR/SVG/paths.html#ArcOutOfRangeParameters says: + // "If either rx or ry is 0, then this arc is treated as a straight line + // segment (a "lineto") joining the endpoints." + path.lineTo(x, y); + return; + } sin_th = qSin(qDegreesToRadians(x_axis_rotation)); cos_th = qCos(qDegreesToRadians(x_axis_rotation)); |
