summaryrefslogtreecommitdiffstats
path: root/src/sp-item.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-08-01 20:07:58 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-08-01 20:07:58 +0000
commitec3dd49a1ccdf9da38c5605765d5698730e77c8b (patch)
tree4ad6969a78832df79b813a2bc36978ada8f51b8a /src/sp-item.cpp
parentupdate to latest 2geom (diff)
downloadinkscape-ec3dd49a1ccdf9da38c5605765d5698730e77c8b.tar.gz
inkscape-ec3dd49a1ccdf9da38c5605765d5698730e77c8b.zip
SPItem::getBounds now always returns a Geom::Rect boundingbox.
(bzr r6517)
Diffstat (limited to 'src/sp-item.cpp')
-rw-r--r--src/sp-item.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 691d471ca..5d7177253 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -702,13 +702,20 @@ NR::Maybe<NR::Rect> SPItem::getBounds(NR::Matrix const &transform,
return r;
}
-NR::Maybe<Geom::Rect>
+/*
+ * If the item is empty, or has an empty boundingbox for another reason, this method will
+ * return an empty rectangle. I.e. "getBounds(...).isEmpty() == true".
+ */
+Geom::Rect
SPItem::getBounds(Geom::Matrix const &transform, SPItem::BBoxType type, unsigned int /*dkey*/)
const
{
NR::Maybe<NR::Rect> r = NR::Nothing();
sp_item_invoke_bbox_full(this, &r, from_2geom(transform), type, TRUE);
- return NR::Maybe<Geom::Rect>(to_2geom(*r));
+ if (r)
+ return to_2geom(*r);
+ else
+ return Geom::Rect(); // return empty rectangle
}
void