diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2017-01-19 20:54:24 +0100 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2017-01-19 20:54:54 +0100 |
commit | 4fa4b9a1359131d861470376a34750211cf1a1ae (patch) | |
tree | 83d0395d654f9225c258456aa9e68b3ab334f945 /libs/canvas/flag.cc | |
parent | 758f183b99dadd173cc5b0f8b9e76f6cc3e02159 (diff) |
remove use of boost::optional to define "undefined" Canvas::Rect, and use Rect::empty instead.
This commit includes Rect::operator bool() which might be a candidate for removal in a future commit, in an attempt
to make the meaning clearer
Diffstat (limited to 'libs/canvas/flag.cc')
-rw-r--r-- | libs/canvas/flag.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libs/canvas/flag.cc b/libs/canvas/flag.cc index 3e11f7c1b6..b00426ff92 100644 --- a/libs/canvas/flag.cc +++ b/libs/canvas/flag.cc @@ -80,10 +80,10 @@ Flag::set_text (string const & text) _text->set (text); } - boost::optional<Rect> bbox = _text->bounding_box (); + Rect bbox = _text->bounding_box (); assert (bbox); - Duple flag_size (bbox.get().width() + 10, bbox.get().height() + 4); + Duple flag_size (bbox.width() + 10, bbox.height() + 4); if (_invert) { const Distance h = fabs(_line->y1() - _line->y0()); @@ -101,9 +101,9 @@ Flag::set_height (Distance h) _line->set (Duple (0, 0), Duple (0, h)); if (_invert) { - boost::optional<Rect> bbox = _text->bounding_box (); + Rect bbox = _text->bounding_box (); if (bbox) { - Duple flag_size (bbox.get().width() + 10, bbox.get().height() + 4); + Duple flag_size (bbox.width() + 10, bbox.height() + 4); _rectangle->set (Rect (0, h - flag_size.y, flag_size.x, h)); _text->set_position (Duple (5, h - flag_size.y + 2)); } @@ -123,8 +123,8 @@ Flag::covers (Duple const & point) const double Flag::width () const { - boost::optional<Rect> bbox = _text->bounding_box (); + Rect bbox = _text->bounding_box (); assert (bbox); - return bbox.get().width() + 10; + return bbox.width() + 10; } |