summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2009-07-23 13:26:11 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2009-07-23 13:26:11 (GMT)
commitc29d1cc49998ef895df9dcbccafe1b6d6d8e7efc (patch)
treefb008b7977d257e5a86aa93846cdd4160ca87b93 /src
parent2851458fbefcc4785a1a76f5216af6159d6c7116 (diff)
downloadQt-c29d1cc49998ef895df9dcbccafe1b6d6d8e7efc.zip
Qt-c29d1cc49998ef895df9dcbccafe1b6d6d8e7efc.tar.gz
Qt-c29d1cc49998ef895df9dcbccafe1b6d6d8e7efc.tar.bz2
QPainter::stroke() on raster engine would draw moveto's as lines
The reason being that there was an assumption that any non-curved path was a continous polyline. For paths with multiple subpaths in it we need to split this up into multiple strokePolygonCosmetic calls. Task-number: 257621 Reviewed-by: Kim Motoyoshi Kalland
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index a34c264..5176444 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1682,11 +1682,23 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
if (!s->penData.blend)
return;
- if (s->flags.fast_pen && path.shape() <= QVectorPath::NonCurvedShapeHint && s->lastPen.brush().isOpaque()) {
- strokePolygonCosmetic((QPointF *) path.points(), path.elementCount(),
- path.hasImplicitClose()
- ? WindingMode
- : PolylineMode);
+ if (s->flags.fast_pen && path.shape() <= QVectorPath::NonCurvedShapeHint
+ && s->lastPen.brush().isOpaque()) {
+ int count = path.elementCount();
+ QPointF *points = (QPointF *) path.points();
+ const QPainterPath::ElementType *types = path.elements();
+ int first = 0;
+ int last;
+ while (first < count) {
+ while (first < count && types[first] != QPainterPath::MoveToElement) ++first;
+ last = first + 1;
+ while (last < count && types[last] == QPainterPath::LineToElement) ++last;
+ strokePolygonCosmetic(points + first, last - first,
+ path.hasImplicitClose() && last == count // only close last one..
+ ? WindingMode
+ : PolylineMode);
+ first = last;
+ }
} else if (s->flags.non_complex_pen && path.shape() == QVectorPath::LinesHint) {
qreal width = s->lastPen.isCosmetic()