summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-03-10 13:17:50 (GMT)
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-03-10 14:38:16 (GMT)
commit477a3f2720710130dad88a1e8391f7eaf24ffb38 (patch)
tree45be0bfdafc636bbc0e47f18d5ded8fbbfbcadfe /src
parent1ceb2ec18056c41c040e3087f79860b7eb7b9d3f (diff)
downloadQt-477a3f2720710130dad88a1e8391f7eaf24ffb38.zip
Qt-477a3f2720710130dad88a1e8391f7eaf24ffb38.tar.gz
Qt-477a3f2720710130dad88a1e8391f7eaf24ffb38.tar.bz2
Fixed assert failure when drawing dashes with raster engine.
Reviewed-by: Samuel
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index bfcf7db..03d0825 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1725,9 +1725,10 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
if (patternLength > 0) {
int n = qFloor(dashOffset / patternLength);
dashOffset -= n * patternLength;
- while (dashOffset > pattern.at(dashIndex)) {
+ while (dashOffset >= pattern.at(dashIndex)) {
dashOffset -= pattern.at(dashIndex);
- dashIndex = (dashIndex + 1) % pattern.size();
+ if (++dashIndex >= pattern.size())
+ dashIndex = 0;
inDash = !inDash;
}
}
@@ -1738,7 +1739,6 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
const QLineF *lines = reinterpret_cast<const QLineF *>(path.points());
for (int i = 0; i < lineCount; ++i) {
- dashOffset = s->lastPen.dashOffset();
if (lines[i].p1() == lines[i].p2()) {
if (s->lastPen.capStyle() != Qt::FlatCap) {
QPointF p = lines[i].p1();
@@ -3626,13 +3626,14 @@ void QRasterPaintEnginePrivate::rasterizeLine_dashed(QLineF line,
} else {
*dashOffset = 0;
*inDash = !(*inDash);
- *dashIndex = (*dashIndex + 1) % pattern.size();
+ if (++*dashIndex >= pattern.size())
+ *dashIndex = 0;
length -= dash;
l.setLength(dash);
line.setP1(l.p2());
}
- if (rasterize && dash != 0)
+ if (rasterize && dash > 0)
rasterizer->rasterizeLine(l.p1(), l.p2(), width / dash, squareCap);
}
}