diff options
| author | MenTaLguY <mental@rydia.net> | 2007-03-04 19:06:34 +0000 |
|---|---|---|
| committer | mental <mental@users.sourceforge.net> | 2007-03-04 19:06:34 +0000 |
| commit | 06b346c6b592e8a0d9609e42c5a509ee9ebe519b (patch) | |
| tree | d11771089b02bc74843859851025824a6d8ac3b9 /src/selection.cpp | |
| parent | replace use of invokeBbox in flood fill tool (diff) | |
| download | inkscape-06b346c6b592e8a0d9609e42c5a509ee9ebe519b.tar.gz inkscape-06b346c6b592e8a0d9609e42c5a509ee9ebe519b.zip | |
adapt code to new Maybe/bbox regime
(bzr r2538)
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 { |
