Code

fix bug 379378
[inkscape.git] / src / sp-tref.cpp
index 0c6da351812f0c30659c40e37264d7cf3c4c56bd..83f9ecfa6e3cf2f8a1b9d98a432789fa7449c3a2 100644 (file)
@@ -63,9 +63,9 @@ static void sp_tref_release(SPObject *object);
 static void sp_tref_set(SPObject *object, unsigned int key, gchar const *value);
 static void sp_tref_update(SPObject *object, SPCtx *ctx, guint flags);
 static void sp_tref_modified(SPObject *object, guint flags);
-static Inkscape::XML::Node *sp_tref_write(SPObject *object, Inkscape::XML::Node *repr, guint flags);
+static Inkscape::XML::Node *sp_tref_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
 
-static void sp_tref_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags);
+static void sp_tref_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
 static gchar *sp_tref_description(SPItem *item);
 
 static void sp_tref_href_changed(SPObject *old_ref, SPObject *ref, SPTRef *tref);
@@ -290,14 +290,13 @@ sp_tref_modified(SPObject *object, guint flags)
  * Writes its settings to an incoming repr object, if any.
  */
 static Inkscape::XML::Node *
-sp_tref_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
+sp_tref_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
 {
     debug("0x%p",object);
 
     SPTRef *tref = SP_TREF(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:tref");
     }
 
@@ -311,7 +310,7 @@ sp_tref_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
     }
 
     if (((SPObjectClass *) tref_parent_class)->write) {
-        ((SPObjectClass *) tref_parent_class)->write(object, repr, flags);
+        ((SPObjectClass *) tref_parent_class)->write(object, xml_doc, repr, flags);
     }
 
     return repr;
@@ -321,11 +320,11 @@ sp_tref_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
  *  The code for this function is swiped from the tspan bbox code, since tref should work pretty much the same way
  */
 static void
-sp_tref_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const /*flags*/)
+sp_tref_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const /*flags*/)
 {
     // find out the ancestor text which holds our layout
     SPObject *parent_text = SP_OBJECT(item);
-    for (; parent_text != NULL && !SP_IS_TEXT(parent_text); parent_text = SP_OBJECT_PARENT (parent_text));
+    for (; parent_text != NULL && !SP_IS_TEXT(parent_text); parent_text = SP_OBJECT_PARENT (parent_text)){};
     if (parent_text == NULL) return;
 
     // get the bbox of our portion of the layout
@@ -335,7 +334,7 @@ sp_tref_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsi
     // Add stroke width
     SPStyle* style=SP_OBJECT_STYLE (item);
     if (!style->stroke.isNone()) {
-        double const scale = expansion(transform);
+        double const scale = transform.descrim();
         if ( fabs(style->stroke_width.computed * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord
             double const width = MAX(0.125, style->stroke_width.computed * scale);
             if ( fabs(bbox->x1 - bbox->x0) > -0.00001 && fabs(bbox->y1 - bbox->y0) > -0.00001 ) {