Code

make spcurve::first_point and last_point boost::optional
[inkscape.git] / src / sp-star.cpp
index 6543a98660040dea094e7a27d9bc5585b1c161a7..96bc9180a9f9ff197411ee0b3f939470ae48ea97 100644 (file)
@@ -34,7 +34,7 @@ static void sp_star_class_init (SPStarClass *klass);
 static void sp_star_init (SPStar *star);
 
 static void sp_star_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
-static Inkscape::XML::Node *sp_star_write (SPObject *object, Inkscape::XML::Node *repr, guint flags);
+static Inkscape::XML::Node *sp_star_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
 static void sp_star_set (SPObject *object, unsigned int key, const gchar *value);
 static void sp_star_update (SPObject *object, SPCtx *ctx, guint flags);
 
@@ -129,12 +129,11 @@ sp_star_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * r
 }
 
 static Inkscape::XML::Node *
-sp_star_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
+sp_star_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
 {
        SPStar *star = SP_STAR (object);
 
        if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
-               Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
                repr = xml_doc->createElement("svg:path");
        }
 
@@ -152,13 +151,13 @@ sp_star_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
                sp_repr_set_svg_double(repr, "inkscape:randomized", star->randomized);
        }
 
-       sp_star_set_shape ((SPShape *) star);
-       char *d = sp_svg_write_path (SP_CURVE_BPATH(((SPShape *) star)->curve));
-       repr->setAttribute("d", d);
-       g_free (d);
+    sp_star_set_shape ((SPShape *) star);
+    char *d = sp_svg_write_path (((SPShape *) star)->curve->get_pathvector());
+    repr->setAttribute("d", d);
+    g_free (d);
 
        if (((SPObjectClass *) (parent_class))->write)
-               ((SPObjectClass *) (parent_class))->write (object, repr, flags);
+               ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags);
 
        return repr;
 }
@@ -285,14 +284,9 @@ sp_star_update_patheffect(SPLPEItem *lpeitem, bool write)
     if (write) {
         Inkscape::XML::Node *repr = SP_OBJECT_REPR(shape);
         if ( shape->curve != NULL ) {
-            NArtBpath const * abp = shape->curve->get_bpath();
-            if (abp) {
-                gchar *str = sp_svg_write_path(abp);
-                repr->setAttribute("d", str);
-                g_free(str);
-            } else {
-                repr->setAttribute("d", "");
-            }
+            gchar *str = sp_svg_write_path(shape->curve->get_pathvector());
+            repr->setAttribute("d", str);
+            g_free(str);
         } else {
             repr->setAttribute("d", NULL);
         }