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>
This commit is contained in:
parent
fd7b52d268
commit
b528e1324a
@ -583,6 +583,7 @@ void QCosmeticStroker::drawPath(const QVectorPath &path)
|
|||||||
patternOffset = state->lastPen.dashOffset()*64;
|
patternOffset = state->lastPen.dashOffset()*64;
|
||||||
lastPixel.x = -1;
|
lastPixel.x = -1;
|
||||||
|
|
||||||
|
const qreal *begin = points;
|
||||||
const qreal *end = points + 2*path.elementCount();
|
const qreal *end = points + 2*path.elementCount();
|
||||||
// handle closed path case
|
// handle closed path case
|
||||||
bool closed = path.hasImplicitClose() || (points[0] == end[-2] && points[1] == end[-1]);
|
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());
|
calculateLastPoint(p2.x(), p2.y(), p.x(), p.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool fastPenAliased = (state->flags.fast_pen && !state->flags.antialiased);
|
||||||
points += 2;
|
points += 2;
|
||||||
while (points < end) {
|
while (points < end) {
|
||||||
QPointF p2 = QPointF(points[0], points[1]) * state->matrix;
|
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)
|
if (!closed && drawCaps && points == end - 2)
|
||||||
caps |= CapEnd;
|
caps |= CapEnd;
|
||||||
|
|
||||||
|
QCosmeticStroker::Point last = this->lastPixel;
|
||||||
stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps);
|
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;
|
points += 2;
|
||||||
caps = NoCaps;
|
caps = NoCaps;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user