diff options
| author | MenTaLguY <mental@rydia.net> | 2007-03-04 19:05:50 +0000 |
|---|---|---|
| committer | mental <mental@users.sourceforge.net> | 2007-03-04 19:05:50 +0000 |
| commit | 360ced76a668588a206d346ed26920ce3113e67f (patch) | |
| tree | 146e366b392936d2cf0819f8d57d788031b6b639 /src | |
| parent | Sketch out new bbox API (diff) | |
| download | inkscape-360ced76a668588a206d346ed26920ce3113e67f.tar.gz inkscape-360ced76a668588a206d346ed26920ce3113e67f.zip | |
implement new API via wrapper for now
(bzr r2535)
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp-item.cpp | 22 | ||||
| -rw-r--r-- | src/sp-item.h | 2 |
2 files changed, 20 insertions, 4 deletions
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<NR::Rect> 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<NR::Rect> getBBox(BBoxType type, NR::Matrix const &transform, unsigned int dkey=0) const; + NR::Maybe<NR::Rect> getBBox(NR::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const; sigc::connection _clip_ref_connection; sigc::connection _mask_ref_connection; |
