summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qtriangulatingstroker.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-05-02 12:58:15 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-05-02 14:49:20 +0000
commit62fc49fb91aa1e170b1ec61baab24bad3291e98d (patch)
tree3735edb4f31291c8eaf91b95543a4106d049e5ce /src/gui/painting/qtriangulatingstroker.cpp
parentd9e55e40a9c0546981981fe2340a52fbb1b47b04 (diff)
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: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/painting/qtriangulatingstroker.cpp')
-rw-r--r--src/gui/painting/qtriangulatingstroker.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/painting/qtriangulatingstroker.cpp b/src/gui/painting/qtriangulatingstroker.cpp
index 6243f1e2a4..3f7b01ddbe 100644
--- a/src/gui/painting/qtriangulatingstroker.cpp
+++ b/src/gui/painting/qtriangulatingstroker.cpp
@@ -525,6 +525,7 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, c
int count = path.elementCount();
bool cosmetic = qt_pen_is_cosmetic(pen, hints);
+ bool implicitClose = path.hasImplicitClose();
m_points.reset();
m_types.reset();
@@ -558,8 +559,14 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, c
if (count < 2)
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);
if (!types) {
@@ -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();
}