Code

use an accessor method to get filter from style
[inkscape.git] / src / sp-shape.cpp
index 55dfe65493c8e4fbd50d0f152ed3b40f7bbf723c..6dba2afb67b2f36a63b0d6f3ecd0ead17c03c4e6 100644 (file)
@@ -619,6 +619,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &tr
         nr_path_matrix_bbox_union(&bp, transform, &cbbox);
 
         if ((SPItem::BBoxType) flags != SPItem::GEOMETRIC_BBOX) {
+            
             SPStyle* style=SP_OBJECT_STYLE (item);
             if (style->stroke.type != SP_PAINT_TYPE_NONE) {
                 double const scale = expansion(transform);
@@ -1020,14 +1021,15 @@ static void sp_shape_snappoints(SPItem const *item, SnapPointsIter p)
 
     /* Use the end points of each segment of the path */
     NArtBpath const *bp = SP_CURVE_BPATH(shape->curve);
+
+    if (bp->code == NR_MOVETO) { // Indicates the start of a closed subpath, see nr-path-code.h
+        bp++; //The first point of a closed path is coincident with the end point. Skip the first point as we need only one
+    }
+
     while (bp->code != NR_END) {
         *p = bp->c(3) * i2d;
         bp++;
     }
-    
-    // Additionaly, add the center for snapping
-    *p = shape->getCenter();
-    
 }