summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@digia.com>2013-03-13 10:40:48 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-20 16:32:30 (GMT)
commit56e4daccf9b1b9c2b3d7103cabc40fb406a23df3 (patch)
tree0aff0c8e0983ccb262cc511df052bdee21ec2de5 /src
parenta2d573ac8e72315e60d4b17903d3035adffb8b18 (diff)
downloadQt-56e4daccf9b1b9c2b3d7103cabc40fb406a23df3.zip
Qt-56e4daccf9b1b9c2b3d7103cabc40fb406a23df3.tar.gz
Qt-56e4daccf9b1b9c2b3d7103cabc40fb406a23df3.tar.bz2
Fixed QPainter::drawPolyline() not drawing solid lines.
If a line segment isn't filled we keep using the same point of origin. Task-number: QTBUG-26156 Change-Id: I20af8410a7039b69848f201ab62fd3c01b95531b Reviewed-by: Titta Heikkala <titta.heikkala@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> (cherry picked from commit b528e1324add2208abf8f83fb51a8bd2183157f5)
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index 9fddaed..0061ecb 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -583,6 +583,7 @@ void QCosmeticStroker::drawPath(const QVectorPath &path)
patternOffset = state->lastPen.dashOffset()*64;
lastPixel.x = -1;
+ const qreal *begin = points;
const qreal *end = points + 2*path.elementCount();
// handle closed path case
bool closed = path.hasImplicitClose() || (points[0] == end[-2] && points[1] == end[-1]);
@@ -592,6 +593,7 @@ void QCosmeticStroker::drawPath(const QVectorPath &path)
calculateLastPoint(p2.x(), p2.y(), p.x(), p.y());
}
+ bool fastPenAliased = (state->flags.fast_pen && !state->flags.antialiased);
points += 2;
while (points < end) {
QPointF p2 = QPointF(points[0], points[1]) * state->matrix;
@@ -599,9 +601,22 @@ void QCosmeticStroker::drawPath(const QVectorPath &path)
if (!closed && drawCaps && points == end - 2)
caps |= CapEnd;
+ QCosmeticStroker::Point last = this->lastPixel;
stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps);
- p = p2;
+ /* fix for gaps in polylines with fastpen and aliased in a sequence
+ of points with small distances: if current point p2 has been dropped
+ out, keep last non dropped point p. */
+ if (fastPenAliased) {
+ if (last.x != lastPixel.x || last.y != lastPixel.y ||
+ points == begin + 2 || points == end - 2 ) {
+ {
+ p = p2;
+ }
+ }
+ } else {
+ p = p2;
+ }
points += 2;
caps = NoCaps;
}