diff options
Diffstat (limited to 'src/selection.cpp')
| -rw-r--r-- | src/selection.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/selection.cpp b/src/selection.cpp index a27e45cb2..82c82b523 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -317,21 +317,18 @@ NRRect *Selection::bounds(NRRect *bbox) const NR::Rect Selection::bounds() const { GSList const *items = const_cast<Selection *>(this)->itemList(); - if (!items) { - return NR::Rect(NR::Point(0, 0), NR::Point(0, 0)); - } - - GSList const *i = items; - NR::Rect bbox = sp_item_bbox_desktop(SP_ITEM(i->data)); - GSList const *i_start = i; - while (i != NULL) { - if (i != i_start) - bbox = NR::Rect::union_bounds(bbox, sp_item_bbox_desktop(SP_ITEM(i->data))); - i = i->next; + NR::Maybe<NR::Rect> bbox = NR::Nothing(); + for ( GSList const *i = items ; i != NULL ; i = i->next ) { + bbox = NR::Rect::union_bounds(bbox, sp_item_bbox_desktop(SP_ITEM(i->data))); } - return bbox; + // TODO: return NR::Maybe<NR::Rect> + if (bbox) { + return *bbox; + } else { + return NR::Rect(NR::Point(0, 0), NR::Point(0, 0)); + } } NRRect *Selection::boundsInDocument(NRRect *bbox) const { |
