summaryrefslogtreecommitdiff
path: root/libs/canvas/canvas/types.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/canvas/canvas/types.h')
-rw-r--r--libs/canvas/canvas/types.h7
1 files changed, 4 insertions, 3 deletions
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;