Code

add SPCurve::get_segment_count
[inkscape.git] / src / nodepath.cpp
index 0a599382364754b9266a98985926cf99b157d256..b712539ab767f78f872a3fb550c54095ae7f1f9f 100644 (file)
@@ -341,8 +341,8 @@ void sp_nodepath_ensure_livarot_path(Inkscape::NodePath::Path *np)
 {
     if (np && np->livarot_path == NULL) {
         SPCurve *curve = create_curve(np);
-        NArtBpath const *bpath = SP_CURVE_BPATH(curve);
-        np->livarot_path = bpath_to_Path(bpath);
+        np->livarot_path = new Path;
+        np->livarot_path->LoadPathVector(curve->get_pathvector());
 
         if (np->livarot_path)
             np->livarot_path->ConvertWithBackData(0.01);
@@ -4706,12 +4706,10 @@ SPCurve* sp_nodepath_object_get_curve(SPObject *object, const gchar *key) {
     } else if ( IS_LIVEPATHEFFECT(object) && key) {
         const gchar *svgd = object->repr->attribute(key);
         if (svgd) {
-            NArtBpath *bpath = sp_svg_read_path(svgd);
-            SPCurve *curve_new = SPCurve::new_from_bpath(bpath);
+            Geom::PathVector pv = sp_svg_read_pathv(svgd);
+            SPCurve *curve_new = new SPCurve(pv);
             if (curve_new) {
                 curve = curve_new; // don't do curve_copy because curve_new is already only created for us!
-            } else {
-                g_free(bpath);
             }
         }
     }
@@ -4741,14 +4739,13 @@ void sp_nodepath_set_curve (Inkscape::NodePath::Path *np, SPCurve *curve) {
 }
 
 SPCanvasItem *
-sp_nodepath_generate_helperpath(SPDesktop *desktop, SPCurve *curve, const SPItem *item) {
+sp_nodepath_generate_helperpath(SPDesktop *desktop, SPCurve *curve, const SPItem *item, guint32 color = 0xff0000ff) {
     SPCurve *flash_curve = curve->copy();
     Geom::Matrix i2d = item ? sp_item_i2d_affine(item) : Geom::identity();
     flash_curve->transform(i2d);
     SPCanvasItem * canvasitem = sp_canvas_bpath_new(sp_desktop_tempgroup(desktop), flash_curve);
     // would be nice if its color could be XORed or something, now it is invisible for red stroked objects...
     // unless we also flash the nodes...
-    guint32 color = prefs_get_int_attribute("tools.nodes", "highlight_color", 0xff0000ff);
     sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(canvasitem), color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
     sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(canvasitem), 0, SP_WIND_RULE_NONZERO);
     sp_canvas_item_show(canvasitem);
@@ -4758,7 +4755,8 @@ sp_nodepath_generate_helperpath(SPDesktop *desktop, SPCurve *curve, const SPItem
 
 SPCanvasItem *
 sp_nodepath_generate_helperpath(SPDesktop *desktop, SPPath *path) {
-    return sp_nodepath_generate_helperpath(desktop, sp_path_get_curve_for_edit(path), SP_ITEM(path));
+    return sp_nodepath_generate_helperpath(desktop, sp_path_get_curve_for_edit(path), SP_ITEM(path),
+                                           prefs_get_int_attribute("tools.nodes", "highlight_color", 0xff0000ff));
 }
 
 void sp_nodepath_show_helperpath(Inkscape::NodePath::Path *np, bool show) {