Code

Connector tool: make connectors avoid the convex hull of shapes.
[inkscape.git] / src / sp-mask.cpp
index 4bdf1d40ea17caba2fb2fc615e27ab6c92aea6f9..20cb38297c126fd07e93a27c1e6687accfc21575 100644 (file)
@@ -43,7 +43,7 @@ static void sp_mask_set (SPObject *object, unsigned int key, const gchar *value)
 static void sp_mask_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
 static void sp_mask_update (SPObject *object, SPCtx *ctx, guint flags);
 static void sp_mask_modified (SPObject *object, guint flags);
-static Inkscape::XML::Node *sp_mask_write (SPObject *object, Inkscape::XML::Node *repr, guint flags);
+static Inkscape::XML::Node *sp_mask_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
 
 SPMaskView *sp_mask_view_new_prepend (SPMaskView *list, unsigned int key, NRArenaItem *arenaitem);
 SPMaskView *sp_mask_view_list_remove (SPMaskView *list, SPMaskView *view);
@@ -186,7 +186,6 @@ sp_mask_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML
                                                               SP_ITEM_REFERENCE_FLAGS);
                        if (ac) {
                                nr_arena_item_add_child (v->arenaitem, ac, NULL);
-                               nr_arena_item_unref (ac);
                        }
                }
        }
@@ -220,7 +219,7 @@ sp_mask_update (SPObject *object, SPCtx *ctx, guint flags)
        SPMask *mask = SP_MASK (object);
        for (SPMaskView *v = mask->display; v != NULL; v = v->next) {
                if (mask->maskContentUnits == SP_CONTENT_UNITS_OBJECTBOUNDINGBOX) {
-            NR::Matrix t(NR::scale(v->bbox.x1 - v->bbox.x0, v->bbox.y1 - v->bbox.y0));
+            Geom::Matrix t(Geom::Scale(v->bbox.x1 - v->bbox.x0, v->bbox.y1 - v->bbox.y0));
                        t[4] = v->bbox.x0;
                        t[5] = v->bbox.y0;
                        nr_arena_group_set_child_transform (NR_ARENA_GROUP (v->arenaitem), &t);
@@ -257,22 +256,21 @@ sp_mask_modified (SPObject *object, guint flags)
 }
 
 static Inkscape::XML::Node *
-sp_mask_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
+sp_mask_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
 {
        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:mask");
        }
 
        if (((SPObjectClass *) (parent_class))->write)
-               ((SPObjectClass *) (parent_class))->write (object, repr, flags);
+               ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags);
 
        return repr;
 }
 
 // Create a mask element (using passed elements), add it to <defs>
 const gchar *
-sp_mask_create (GSList *reprs, SPDocument *document, NR::Matrix const* applyTransform)
+sp_mask_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform)
 {
     Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document));
 
@@ -289,7 +287,7 @@ sp_mask_create (GSList *reprs, SPDocument *document, NR::Matrix const* applyTran
         SPItem *item = SP_ITEM(mask_object->appendChildRepr(node));
         
         if (NULL != applyTransform) {
-            NR::Matrix transform (item->transform);
+            Geom::Matrix transform (item->transform);
             transform *= (*applyTransform);
             sp_item_write_transform(item, SP_OBJECT_REPR(item), transform);
         }
@@ -319,13 +317,12 @@ sp_mask_show (SPMask *mask, NRArena *arena, unsigned int key)
                        if (ac) {
                                /* The order is not important in mask */
                                nr_arena_item_add_child (ai, ac, NULL);
-                               nr_arena_item_unref (ac);
                        }
                }
        }
 
        if (mask->maskContentUnits == SP_CONTENT_UNITS_OBJECTBOUNDINGBOX) {
-        NR::Matrix t(NR::scale(mask->display->bbox.x1 - mask->display->bbox.x0, mask->display->bbox.y1 - mask->display->bbox.y0));
+        Geom::Matrix t(Geom::Scale(mask->display->bbox.x1 - mask->display->bbox.x0, mask->display->bbox.y1 - mask->display->bbox.y0));
                t[4] = mask->display->bbox.x0;
                t[5] = mask->display->bbox.y0;
                nr_arena_group_set_child_transform (NR_ARENA_GROUP (ai), &t);