summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@digia.com>2013-03-13 11:40:48 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-15 09:28:01 +0100
commitb528e1324add2208abf8f83fb51a8bd2183157f5 (patch)
treea96077ebb24845c0b2a2d0496899d26e91ee7718 /src
parentfd7b52d268ab3f9cdcdb06a77b715644d2d22ef3 (diff)
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>
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 1de955bc13..7f53bec52f 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;
}