Commit 62fc49fb authored by Allan Sandfeld Jensen's avatar Allan Sandfeld Jensen
Browse files

Handle implicit close in QDashedStrokeProcessor



Otherwise dashed polygons will not be closed when stroked like they
are documented to be.

Task-number: QTBUG-60397
Change-Id: I58e9e3a06af157f9a2789ccab640c9da75867962
Reviewed-by: default avatarEirik Aavitsland <eirik.aavitsland@qt.io>
parent d9e55e40
...@@ -1330,8 +1330,7 @@ void QOpenGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &p ...@@ -1330,8 +1330,7 @@ void QOpenGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &p
QVectorPath dashStroke(dasher.points(), QVectorPath dashStroke(dasher.points(),
dasher.elementCount(), dasher.elementCount(),
dasher.elementTypes(), dasher.elementTypes());
s->renderHints);
stroker.process(dashStroke, pen, clip, s->renderHints); stroker.process(dashStroke, pen, clip, s->renderHints);
} }
......
...@@ -525,6 +525,7 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, c ...@@ -525,6 +525,7 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, c
int count = path.elementCount(); int count = path.elementCount();
bool cosmetic = qt_pen_is_cosmetic(pen, hints); bool cosmetic = qt_pen_is_cosmetic(pen, hints);
bool implicitClose = path.hasImplicitClose();
m_points.reset(); m_points.reset();
m_types.reset(); m_types.reset();
...@@ -558,8 +559,14 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, c ...@@ -558,8 +559,14 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, c
if (count < 2) if (count < 2)
return; return;
const qreal *endPts = pts + (count<<1); bool needsClose = false;
if (implicitClose) {
if (pts[0] != pts[count * 2 - 2] || pts[1] != pts[count * 2 - 1])
needsClose = true;
}
const qreal *firstPts = pts;
const qreal *endPts = pts + (count<<1);
m_dash_stroker.begin(this); m_dash_stroker.begin(this);
if (!types) { if (!types) {
...@@ -605,6 +612,8 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, c ...@@ -605,6 +612,8 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, c
} }
} }
} }
if (needsClose)
m_dash_stroker.lineTo(firstPts[0], firstPts[1]);
m_dash_stroker.end(); m_dash_stroker.end();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment