summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2009-07-24 07:35:41 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2009-07-24 08:08:22 (GMT)
commitc8dbff8b5ae8e4b5ef8a46a5e3b513a5f6f4a205 (patch)
treece068f8d111b8c46a3fba622bf7bf587cf82e58a
parentfdaed851ce71fc474a7959d8fc30b50465a98d0d (diff)
downloadQt-c8dbff8b5ae8e4b5ef8a46a5e3b513a5f6f4a205.zip
Qt-c8dbff8b5ae8e4b5ef8a46a5e3b513a5f6f4a205.tar.gz
Qt-c8dbff8b5ae8e4b5ef8a46a5e3b513a5f6f4a205.tar.bz2
Fixed crash when vectorpath was polygonal only in raster::stroke()
Polygonal vector paths may have types==null, in which case this would have crashed. Reviewed-by: Eskil
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 5176444..069c350 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1687,17 +1687,24 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
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..
+ if (types) {
+ 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 {
+ strokePolygonCosmetic(points, count,
+ path.hasImplicitClose()
? WindingMode
: PolylineMode);
- first = last;
}
} else if (s->flags.non_complex_pen && path.shape() == QVectorPath::LinesHint) {