Code

fix bug !
authorjohanengelen <johanengelen@users.sourceforge.net>
Sat, 17 Jan 2009 20:27:13 +0000 (20:27 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Sat, 17 Jan 2009 20:27:13 +0000 (20:27 +0000)
src/livarot/PathConversion.cpp
src/livarot/PathStroke.cpp

index 29cacb657d1257c20d8fe4714d113f7ce3dcfb39..16717e5bdcfd1382a6fb6815b01edaffec15f1f3 100644 (file)
@@ -252,7 +252,9 @@ void Path::Convert(double treshhold)
                         descr_cmd[curP]->associated = descr_cmd[curP - 1]->associated;
                     }
                 }
-                pts[descr_cmd[curP]->associated].closed = true;
+                if ( descr_cmd[curP]->associated > 0 ) {
+                    pts[descr_cmd[curP]->associated].closed = true;
+                }
                 curP++;
                 break;
             }
@@ -480,7 +482,9 @@ void Path::Convert(NRRectL *area, double treshhold)
                         descr_cmd[curP]->associated = descr_cmd[curP - 1]->associated;
                     }
                 }
-                pts[descr_cmd[curP]->associated].closed = true;
+                if ( descr_cmd[curP]->associated > 0 ) {
+                    pts[descr_cmd[curP]->associated].closed = true;
+                }
                 last_point_relation = 0;
                 curP++;
                 break;
@@ -756,7 +760,9 @@ void Path::ConvertEvenLines(double treshhold)
                         descr_cmd[curP]->associated = descr_cmd[curP - 1]->associated;
                     }
                 }
-                pts[descr_cmd[curP]->associated].closed = true;
+                if ( descr_cmd[curP]->associated > 0 ) {
+                    pts[descr_cmd[curP]->associated].closed = true;
+                }
                 curP++;
                 break;
             }
index 18cd050336e679cd34ee529cc71f963eee8cb93e..465bb205c3260f5db9f89d4adea9800025ef10d9 100644 (file)
@@ -63,12 +63,7 @@ void Path::Stroke(Shape *dest, bool doClose, double width, JoinType join,
         }
 
         if ( lastP > lastM+1 ) {
-            Geom::Point sbStart = pts[lastM].p;
-            Geom::Point sbEnd = pts[lastP - 1].p;
-            if ( pts[lastP - 1].closed /*Geom::LInfty(sbEnd-sbStart) < 0.00001 */ ) {       // why close lines that shouldn't be closed?
-                // ah I see, because close is defined here for
-                // a whole path and should be defined per subpath.
-                // debut==fin => ferme (on devrait garder un element pour les close(), mais tant pis)
+            if ( pts[lastP - 1].closed ) {
                 DoStroke(lastM, lastP - lastM, dest, true, width, join, butt, miter, true);
             } else {
                 DoStroke(lastM, lastP - lastM, dest, doClose, width, join, butt, miter, true);