summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2011-05-19 23:19:47 +0200
committerQt by Nokia <qt-info@nokia.com>2011-06-27 10:59:28 +0200
commitad0ecae41cb66bdcaad15a4059cb3c27f6f6bbeb (patch)
tree2f045920ce45e283293f2c272fc6b4c3264832f2 /src/gui/painting
parent048d840ca2d365c8c60f47ae72d04d6a2a97c379 (diff)
Fix smaller bugs in the stroker
Calculating the continuation point for closed contours was not taking transformations and the half pixel offset into account. (cherry picked from commit 31e9c098f3c9321eebf1ac3e4c44a2d18d3816b8) Change-Id: I735d8e58fc3cf64668f546d5f42892d420d58e84 Reviewed-on: http://codereview.qt.nokia.com/607 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index d694b4b9a8..47a1359288 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -409,10 +409,11 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal
if (clipLine(rx1, ry1, rx2, ry2))
return;
- int x1 = toF26Dot6(rx1);
- int y1 = toF26Dot6(ry1);
- int x2 = toF26Dot6(rx2);
- int y2 = toF26Dot6(ry2);
+ const int half = 32;
+ int x1 = toF26Dot6(rx1) + half;
+ int y1 = toF26Dot6(ry1) + half;
+ int x2 = toF26Dot6(rx2) + half;
+ int y2 = toF26Dot6(ry2) + half;
int dx = qAbs(x2 - x1);
int dy = qAbs(y2 - y1);
@@ -424,6 +425,7 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal
swapped = true;
qSwap(y1, y2);
qSwap(x1, x2);
+ --x1; --x2; --y1; --y2;
}
int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1);
int x = x1 << 10;
@@ -455,6 +457,7 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal
swapped = true;
qSwap(x1, x2);
qSwap(y1, y2);
+ --x1; --x2; --y1; --y2;
}
int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1);
int y = y1 << 10;
@@ -525,7 +528,9 @@ void QCosmeticStroker::drawPath(const QVectorPath &path)
const QPainterPath::ElementType *e = subPath(type, end, points, &closed);
if (closed) {
const qreal *p = points + 2*(e-type);
- calculateLastPoint(p[-4], p[-3], p[-2], p[-1]);
+ QPointF p1 = QPointF(p[-4], p[-3]) * state->matrix;
+ QPointF p2 = QPointF(p[-2], p[-1]) * state->matrix;
+ calculateLastPoint(p1.x(), p1.y(), p2.x(), p2.y());
}
int caps = (!closed & drawCaps) ? CapBegin : NoCaps;
// qDebug() << "closed =" << closed << capString(caps);
@@ -577,8 +582,10 @@ void QCosmeticStroker::drawPath(const QVectorPath &path)
// handle closed path case
bool closed = path.hasImplicitClose() || (points[0] == end[-2] && points[1] == end[-1]);
int caps = (!closed & drawCaps) ? CapBegin : NoCaps;
- if (closed)
- calculateLastPoint(end[-2], end[-1], points[0], points[1]);
+ if (closed) {
+ QPointF p2 = QPointF(end[-2], end[-1]) * state->matrix;
+ calculateLastPoint(p2.x(), p2.y(), p.x(), p.y());
+ }
points += 2;
while (points < end) {