summaryrefslogtreecommitdiff
path: root/libs/canvas
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-01-08 10:42:14 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-01-08 10:42:14 -0500
commitcf293d05934f3f8d664127967dad20877d8f9594 (patch)
treef2d695ab7a4a9ee649d38f593d3960c49989ef1d /libs/canvas
parent35d3a4a351ad96ebf14407dbfb495259ddb2da2c (diff)
tweak rectangle bounding box computation
Diffstat (limited to 'libs/canvas')
-rw-r--r--libs/canvas/rectangle.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/libs/canvas/rectangle.cc b/libs/canvas/rectangle.cc
index 7b7f67c3c6..06a41e074c 100644
--- a/libs/canvas/rectangle.cc
+++ b/libs/canvas/rectangle.cc
@@ -119,11 +119,19 @@ Rectangle::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) con
void
Rectangle::compute_bounding_box () const
{
- /* boundary is drawn inside our coordinates but expanded by 0.5 to get
- * single-pixel drawing correct.
- */
- Rect r = _rect.fix();
- _bounding_box = boost::optional<Rect> (r.expand (_outline_width/2.0));
+ if (!_rect.empty()) {
+ Rect r = _rect.fix ();
+
+ /* our outlines are always inside our coordinates, but we have
+ * to ensure that our bounding box fully *contains* the
+ * rectangle
+ *
+ * XXX: or something like that, waffle.
+ *
+ */
+ _bounding_box = r.expand (1.0);
+ }
+
_bounding_box_dirty = false;
}