summaryrefslogtreecommitdiff
path: root/libs/canvas/rectangle.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-11-05 16:57:37 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-11-05 19:45:23 -0500
commitecd618c343d4fc41e95f0c58795271c2ab3b1980 (patch)
treed4ac161ea7378369165e8c51061a805deb741b94 /libs/canvas/rectangle.cc
parent857719f2e12bdfbb6f770afe75c0f968b2c4fa2c (diff)
correct the rendering of Rectangle outlines, and the computation of their bounding box
Diffstat (limited to 'libs/canvas/rectangle.cc')
-rw-r--r--libs/canvas/rectangle.cc27
1 files changed, 6 insertions, 21 deletions
diff --git a/libs/canvas/rectangle.cc b/libs/canvas/rectangle.cc
index 232da17893..a4540ccbac 100644
--- a/libs/canvas/rectangle.cc
+++ b/libs/canvas/rectangle.cc
@@ -98,20 +98,13 @@ Rectangle::render_self (Rect const & area, Cairo::RefPtr<Cairo::Context> context
* thick, it will precisely align with the corner
* coordinates of the rectangle. So if the rectangle
* has a left edge at 0 and a right edge at 10, then
- * the left edge must span -0.5..+0.5, the right edge
- * must span 9.5..10.5 (i.e. the single full color
- * pixel is precisely aligned with 0 and 10
- * respectively).
- *
- * we have to shift left/up in all cases, which means
- * subtraction along both axes (i.e. edge at
- * N, outline must start at N-0.5).
- *
- * see the cairo FAQ on single pixel lines to see why we do
- * the 0.5 pixel additions.
+ * the left edge must span 0..1, the right edge
+ * must span 9..10 because the first and final pixels
+ * to be colored are actually "at" 0.5 and 9.5 (midway
+ * between the integer coordinates.
*/
- self = self.translate (Duple (0.5, 0.5));
+ self = self.shrink (0.5);
if (_outline_what == What (LEFT|RIGHT|BOTTOM|TOP)) {
@@ -155,13 +148,6 @@ Rectangle::compute_bounding_box () const
{
if (!_rect.empty()) {
Rect r = _rect.fix ();
-
- /* take into acount the 0.5 addition to the bounding
- box for the right and bottom edges, see ::render() above
- */
-
- r = r.expand (1.0);
-
_bounding_box = r;
}
@@ -273,8 +259,7 @@ void
TimeRectangle::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
{
Rect self = get_self_for_render ();
-
-
+
/* This is a TimeRectangle, so its right edge is drawn 1 pixel beyond
* (larger x-axis coordinates) than a normal Rectangle.
*/