Code

Patch from codedread. Prevents rendering of title/desc/metadata elements in text...
[inkscape.git] / src / sp-spiral.cpp
index d543aa00f234d6ac1935212988af5689f023dcf1..3a37a8da278805f91880d93e5d48805f007fdf41 100644 (file)
@@ -31,7 +31,7 @@ static void sp_spiral_class_init (SPSpiralClass *klass);
 static void sp_spiral_init (SPSpiral *spiral);
 
 static void sp_spiral_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
-static Inkscape::XML::Node *sp_spiral_write (SPObject *object, Inkscape::XML::Node *repr, guint flags);
+static Inkscape::XML::Node *sp_spiral_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
 static void sp_spiral_set (SPObject *object, unsigned int key, const gchar *value);
 static void sp_spiral_update (SPObject *object, SPCtx *ctx, guint flags);
 
@@ -141,12 +141,11 @@ sp_spiral_build (SPObject * object, SPDocument * document, Inkscape::XML::Node *
  * Virtual write: write spiral attributes to corresponding repr.
  */
 static Inkscape::XML::Node *
-sp_spiral_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
+sp_spiral_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
 {
        SPSpiral *spiral = SP_SPIRAL (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");
        }
 
@@ -167,26 +166,21 @@ sp_spiral_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
      // make sure the curve is rebuilt with all up-to-date parameters
      sp_spiral_set_shape ((SPShape *) spiral);
 
-        //Duplicate the path
-        SPCurve *curve = ((SPShape *) spiral)->curve;
-        //Nulls might be possible if this called iteratively
-        if ( !curve ) {
-                //g_warning("sp_spiral_write(): No path to copy\n");
-                return NULL;
-        }
-        NArtBpath *bpath = SP_CURVE_BPATH(curve);
-        if ( !bpath ) {
-                //g_warning("sp_spiral_write(): No path to copy\n");
-                return NULL;
-        }
-       char *d = sp_svg_write_path ( bpath );
-       repr->setAttribute("d", d);
-       g_free (d);
+    //Duplicate the path
+    SPCurve *curve = ((SPShape *) spiral)->curve;
+    //Nulls might be possible if this called iteratively
+    if ( !curve ) {
+            //g_warning("sp_spiral_write(): No path to copy\n");
+            return NULL;
+    }
+    char *d = sp_svg_write_path ( curve->get_pathvector() );
+    repr->setAttribute("d", d);
+    g_free (d);
 
-       if (((SPObjectClass *) (parent_class))->write)
-               ((SPObjectClass *) (parent_class))->write (object, repr, flags | SP_SHAPE_WRITE_PATH);
+    if (((SPObjectClass *) (parent_class))->write)
+        ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags | SP_SHAPE_WRITE_PATH);
 
-       return repr;
+    return repr;
 }
 
 /**
@@ -308,14 +302,9 @@ sp_spiral_update_patheffect(SPLPEItem *lpeitem, bool write)
     if (write) {
         Inkscape::XML::Node *repr = SP_OBJECT_REPR(shape);
         if ( shape->curve != NULL ) {
-            NArtBpath *abp = shape->curve->first_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);
         }