src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
changeset 22 79de32ba3296
parent 18 2f34d5167611
child 30 5dc02b23752f
--- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp	Mon May 03 13:17:34 2010 +0300
+++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp	Fri May 14 16:40:13 2010 +0300
@@ -144,11 +144,17 @@
     m_cos_theta = qFastCos(Q_PI / m_roundness);
 
     const qreal *endPts = pts + (count<<1);
-    const qreal *startPts;
+    const qreal *startPts = 0;
 
     Qt::PenCapStyle cap = m_cap_style;
 
     if (!types) {
+        // skip duplicate points
+        while((pts + 2) < endPts && pts[0] == pts[2] && pts[1] == pts[3])
+            pts += 2;
+        if ((pts + 2) == endPts)
+            return;
+
         startPts = pts;
 
         bool endsAtStart = startPts[0] == *(endPts-2) && startPts[1] == *(endPts-1);
@@ -161,15 +167,17 @@
         lineTo(pts);
         pts += 2;
         while (pts < endPts) {
-            join(pts);
-            lineTo(pts);
+            if (m_cx != pts[0] || m_cy != pts[1]) {
+                join(pts);
+                lineTo(pts);
+            }
             pts += 2;
         }
 
         endCapOrJoinClosed(startPts, pts-2, path.hasImplicitClose(), endsAtStart);
 
     } else {
-        bool endsAtStart;
+        bool endsAtStart = false;
         while (pts < endPts) {
             switch (*types) {
             case QPainterPath::MoveToElement: {