diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp
index 7a0d3ed5b9fc95b266ea7e716ace8319251f98a9..4bbabc965fbaf3360018461fe9bec96615e81192 100644 (file)
--- a/src/sp-clippath.cpp
+++ b/src/sp-clippath.cpp
#include "sp-item.h"
#include "libnr/nr-matrix-ops.h"
+#include <2geom/transforms.h>
#include "sp-clippath.h"
static void sp_clippath_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
static void sp_clippath_update(SPObject *object, SPCtx *ctx, guint flags);
static void sp_clippath_modified(SPObject *object, guint flags);
-static Inkscape::XML::Node *sp_clippath_write(SPObject *object, Inkscape::XML::Node *repr, guint flags);
+static Inkscape::XML::Node *sp_clippath_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
SPClipPathView *sp_clippath_view_new_prepend(SPClipPathView *list, unsigned int key, NRArenaItem *arenaitem);
SPClipPathView *sp_clippath_view_list_remove(SPClipPathView *list, SPClipPathView *view);
@@ -171,7 +172,6 @@ sp_clippath_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::
SP_ITEM_REFERENCE_FLAGS);
if (ac) {
nr_arena_item_add_child(v->arenaitem, ac, NULL);
- nr_arena_item_unref(ac);
}
}
}
SPClipPath *cp = SP_CLIPPATH(object);
for (SPClipPathView *v = cp->display; v != NULL; v = v->next) {
if (cp->clipPathUnits == 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);
}
static Inkscape::XML::Node *
-sp_clippath_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
+sp_clippath_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:clipPath");
}
if (((SPObjectClass *) (parent_class))->write)
- ((SPObjectClass *) (parent_class))->write(object, repr, flags);
+ ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags);
return repr;
}
if (ac) {
/* The order is not important in clippath */
nr_arena_item_add_child(ai, ac, NULL);
- nr_arena_item_unref(ac);
}
}
}
if (cp->clipPathUnits == SP_CONTENT_UNITS_OBJECTBOUNDINGBOX) {
- NR::Matrix t(NR::scale(cp->display->bbox.x1 - cp->display->bbox.x0, cp->display->bbox.y1 - cp->display->bbox.y0));
+ Geom::Matrix t(Geom::Scale(cp->display->bbox.x1 - cp->display->bbox.x0, cp->display->bbox.y1 - cp->display->bbox.y0));
t[4] = cp->display->bbox.x0;
t[5] = cp->display->bbox.y0;
nr_arena_group_set_child_transform(NR_ARENA_GROUP(ai), &t);
}
void
-sp_clippath_get_bbox(SPClipPath *cp, NRRect *bbox, NR::Matrix const &transform, unsigned const /*flags*/)
+sp_clippath_get_bbox(SPClipPath *cp, NRRect *bbox, Geom::Matrix const &transform, unsigned const /*flags*/)
{
SPObject *i;
- for (i = sp_object_first_child(SP_OBJECT(cp)); i && !SP_IS_ITEM(i); i = SP_OBJECT_NEXT(i));
+ for (i = sp_object_first_child(SP_OBJECT(cp)); i && !SP_IS_ITEM(i); i = SP_OBJECT_NEXT(i)){};
if (!i) return;
- sp_item_invoke_bbox_full(SP_ITEM(i), bbox, NR::Matrix(SP_ITEM(i)->transform) * transform, SPItem::GEOMETRIC_BBOX, FALSE);
+ sp_item_invoke_bbox_full(SP_ITEM(i), bbox, Geom::Matrix(SP_ITEM(i)->transform) * transform, SPItem::GEOMETRIC_BBOX, FALSE);
SPObject *i_start = i;
while (i != NULL) {
if (i != i_start) {
NRRect i_box;
- sp_item_invoke_bbox_full(SP_ITEM(i), &i_box, NR::Matrix(SP_ITEM(i)->transform) * transform, SPItem::GEOMETRIC_BBOX, FALSE);
+ sp_item_invoke_bbox_full(SP_ITEM(i), &i_box, Geom::Matrix(SP_ITEM(i)->transform) * transform, SPItem::GEOMETRIC_BBOX, FALSE);
nr_rect_d_union (bbox, bbox, &i_box);
}
i = SP_OBJECT_NEXT(i);
- for (; i && !SP_IS_ITEM(i); i = SP_OBJECT_NEXT(i));
+ for (; i && !SP_IS_ITEM(i); i = SP_OBJECT_NEXT(i)){};
}
}
// Create a mask element (using passed elements), add it to <defs>
const gchar *
-sp_clippath_create (GSList *reprs, SPDocument *document, NR::Matrix const* applyTransform)
+sp_clippath_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform)
{
Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document));
@@ -400,7 +398,7 @@ sp_clippath_create (GSList *reprs, SPDocument *document, NR::Matrix const* apply
SPItem *item = SP_ITEM(clip_path_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);
}