src/gui/painting/qpainterpath_p.h
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/src/gui/painting/qpainterpath_p.h	Tue Jan 26 12:42:25 2010 +0200
+++ b/src/gui/painting/qpainterpath_p.h	Tue Feb 02 00:43:10 2010 +0200
@@ -81,8 +81,8 @@
 class QVectorPathConverter
 {
 public:
-    QVectorPathConverter(const QVector<QPainterPath::Element> &path, uint fillRule)
-        : pathData(path, fillRule),
+    QVectorPathConverter(const QVector<QPainterPath::Element> &path, uint fillRule, bool convex)
+        : pathData(path, fillRule, convex),
           path(pathData.points.data(), path.size(),
                pathData.elements.data(), pathData.flags) {}
 
@@ -91,7 +91,7 @@
     }
 
     struct QVectorPathData {
-        QVectorPathData(const QVector<QPainterPath::Element> &path, uint fillRule)
+        QVectorPathData(const QVector<QPainterPath::Element> &path, uint fillRule, bool convex)
             : elements(path.size()),
               points(path.size() * 2),
               flags(0)
@@ -103,7 +103,7 @@
                 points[ptsPos++] = e.x;
                 points[ptsPos++] = e.y;
                 if (e.type == QPainterPath::CurveToElement)
-                    flags |= QVectorPath::CurvedShapeHint;
+                    flags |= QVectorPath::CurvedShapeMask;
             }
 
             if (fillRule == Qt::WindingFill)
@@ -111,6 +111,8 @@
             else
                 flags |= QVectorPath::OddEvenFill;
 
+            if (!convex)
+                flags |= QVectorPath::NonConvexShapeMask;
         }
         QVarLengthArray<QPainterPath::ElementType> elements;
         QVarLengthArray<qreal> points;
@@ -128,19 +130,24 @@
 {
 public:
     QPainterPathData() :
-        cStart(0), fillRule(Qt::OddEvenFill),
-        dirtyBounds(false), dirtyControlBounds(false),
+        cStart(0),
+        fillRule(Qt::OddEvenFill),
+        dirtyBounds(false),
+        dirtyControlBounds(false),
         pathConverter(0)
     {
         ref = 1;
         require_moveTo = false;
+        convex = false;
     }
 
     QPainterPathData(const QPainterPathData &other) :
         QPainterPathPrivate(), cStart(other.cStart), fillRule(other.fillRule),
-        dirtyBounds(other.dirtyBounds), bounds(other.bounds),
+        bounds(other.bounds),
+        controlBounds(other.controlBounds),
+        dirtyBounds(other.dirtyBounds),
         dirtyControlBounds(other.dirtyControlBounds),
-        controlBounds(other.controlBounds),
+        convex(other.convex),
         pathConverter(0)
     {
         ref = 1;
@@ -158,19 +165,20 @@
 
     const QVectorPath &vectorPath() {
         if (!pathConverter)
-            pathConverter = new QVectorPathConverter(elements, fillRule);
+            pathConverter = new QVectorPathConverter(elements, fillRule, convex);
         return pathConverter->path;
     }
 
     int cStart;
     Qt::FillRule fillRule;
 
-    bool require_moveTo;
+    QRectF bounds;
+    QRectF controlBounds;
 
-    bool   dirtyBounds;
-    QRectF bounds;
-    bool   dirtyControlBounds;
-    QRectF controlBounds;
+    uint require_moveTo : 1;
+    uint dirtyBounds : 1;
+    uint dirtyControlBounds : 1;
+    uint convex : 1;
 
     QVectorPathConverter *pathConverter;
 };