From: mental Date: Sun, 4 Mar 2007 19:05:50 +0000 (+0000) Subject: implement new API via wrapper for now X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9608cf1b33040767b837e6be3a4cbbb72a09cc36;p=inkscape.git implement new API via wrapper for now --- diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 6893c752b..f94a5e404 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -634,9 +634,12 @@ sp_item_write(SPObject *const object, Inkscape::XML::Node *repr, guint flags) { SPItem *item = SP_ITEM(object); - gchar *c = sp_svg_transform_write(item->transform); - repr->setAttribute("transform", c); - g_free(c); + gchar c[256]; + if (sp_svg_transform_write(c, 256, item->transform)) { + repr->setAttribute("transform", c); + } else { + repr->setAttribute("transform", NULL); + } SPObject const *const parent = SP_OBJECT_PARENT(object); /** \todo Can someone please document why this is conditional on having @@ -715,6 +718,19 @@ NR::Rect SPItem::invokeBbox(NR::Matrix const &transform) const return NR::Rect(r); } +NR::Maybe SPItem::getBBox(NR::Matrix const &transform, + SPItem::BBoxType type, + unsigned int dkey) const +{ + NRRect r; + sp_item_invoke_bbox_full(this, &r, transform, 0, TRUE); + if (nr_rect_d_test_empty(&r)) { + return NR::Nothing(); + } else { + return NR::Rect(r); + } +} + void sp_item_invoke_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const clear) { diff --git a/src/sp-item.h b/src/sp-item.h index 41100060e..559694276 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -149,7 +149,7 @@ struct SPItem : public SPObject { void lowerToBottom(); NR::Rect invokeBbox(NR::Matrix const &transform) const; - NR::Maybe getBBox(BBoxType type, NR::Matrix const &transform, unsigned int dkey=0) const; + NR::Maybe getBBox(NR::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const; sigc::connection _clip_ref_connection; sigc::connection _mask_ref_connection;