summaryrefslogtreecommitdiff
path: root/libs/canvas/canvas
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2017-01-19 20:54:24 +0100
committerPaul Davis <paul@linuxaudiosystems.com>2017-01-19 20:54:54 +0100
commit4fa4b9a1359131d861470376a34750211cf1a1ae (patch)
tree83d0395d654f9225c258456aa9e68b3ab334f945 /libs/canvas/canvas
parent758f183b99dadd173cc5b0f8b9e76f6cc3e02159 (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/canvas')
-rw-r--r--libs/canvas/canvas/canvas.h8
-rw-r--r--libs/canvas/canvas/item.h6
-rw-r--r--libs/canvas/canvas/types.h7
3 files changed, 11 insertions, 10 deletions
diff --git a/libs/canvas/canvas/canvas.h b/libs/canvas/canvas/canvas.h
index 7731b8533b..7932705483 100644
--- a/libs/canvas/canvas/canvas.h
+++ b/libs/canvas/canvas/canvas.h
@@ -95,11 +95,11 @@ public:
ArdourCanvas::Color background_color() const { return _bg_color; }
/** Called when an item is being destroyed */
- virtual void item_going_away (Item *, boost::optional<Rect>) {}
+ virtual void item_going_away (Item *, Rect) {}
void item_shown_or_hidden (Item *);
void item_visual_property_changed (Item*);
- void item_changed (Item *, boost::optional<Rect>);
- void item_moved (Item *, boost::optional<Rect>);
+ void item_changed (Item *, Rect);
+ void item_moved (Item *, Rect);
Duple canvas_to_window (Duple const&, bool rounded = true) const;
Duple window_to_canvas (Duple const&) const;
@@ -224,7 +224,7 @@ public:
void pick_current_item (Duple const &, int state);
private:
- void item_going_away (Item *, boost::optional<Rect>);
+ void item_going_away (Item *, Rect);
bool send_leave_event (Item const *, double, double) const;
Cairo::RefPtr<Cairo::Surface> canvas_image;
diff --git a/libs/canvas/canvas/item.h b/libs/canvas/canvas/item.h
index dacb9d559b..517b4401ba 100644
--- a/libs/canvas/canvas/item.h
+++ b/libs/canvas/canvas/item.h
@@ -136,7 +136,7 @@ public:
ScrollGroup* scroll_parent() const { return _scroll_parent; }
- boost::optional<Rect> bounding_box () const;
+ Rect bounding_box () const;
Coord height() const;
Coord width() const;
@@ -275,10 +275,10 @@ protected:
/** true if this item is visible (ie to be drawn), otherwise false */
bool _visible;
/** our bounding box before any change that is currently in progress */
- boost::optional<Rect> _pre_change_bounding_box;
+ Rect _pre_change_bounding_box;
/** our bounding box; may be out of date if _bounding_box_dirty is true */
- mutable boost::optional<Rect> _bounding_box;
+ mutable Rect _bounding_box;
/** true if _bounding_box might be out of date, false if its definitely not */
mutable bool _bounding_box_dirty;
diff --git a/libs/canvas/canvas/types.h b/libs/canvas/canvas/types.h
index d0fecf1fda..a3f1b81ea1 100644
--- a/libs/canvas/canvas/types.h
+++ b/libs/canvas/canvas/types.h
@@ -117,15 +117,15 @@ struct LIBCANVAS_API Rect
Coord x1;
Coord y1;
- boost::optional<Rect> intersection (Rect const & o) const throw () {
+ Rect intersection (Rect const & o) const throw () {
Rect i (std::max (x0, o.x0), std::max (y0, o.y0),
std::min (x1, o.x1), std::min (y1, o.y1));
if (i.x0 > i.x1 || i.y0 > i.y1) {
- return boost::optional<Rect> ();
+ return Rect();
}
- return boost::optional<Rect> (i);
+ return i;
}
Rect extend (Rect const & o) const throw () {
@@ -165,6 +165,7 @@ struct LIBCANVAS_API Rect
}
bool empty() const throw () { return (x0 == x1 && y0 == y1); }
+ operator bool() const throw () { return !empty(); }
Distance width () const throw () {
return x1 - x0;