Prefer const references for Pin/Channel maps
[ardour.git] / libs / canvas / ruler.cc
index 75c2d0f719404203750d431b7607f7d93700f830..9949836fa1bd5542cee115ad58669946be506f1e 100644 (file)
@@ -25,7 +25,6 @@
 #include "canvas/ruler.h"
 #include "canvas/types.h"
 #include "canvas/debug.h"
-#include "canvas/utils.h"
 #include "canvas/canvas.h"
 
 using namespace std;
@@ -103,13 +102,13 @@ Ruler::render (Rect const & area, Cairo::RefPtr<Cairo::Context> cr) const
        }
 
        Rect self (item_to_window (get()));
-       boost::optional<Rect> i = self.intersection (area);
+       Rect i = self.intersection (area);
 
        if (!i) {
                return;
        }
 
-       Rect intersection (i.get());
+       Rect intersection (i);
 
        Distance height = self.height();
 
@@ -189,7 +188,7 @@ Ruler::render (Rect const & area, Cairo::RefPtr<Cairo::Context> cr) const
                        if (_divide_height >= 0) {
                                cr->move_to (pos.x + 2.0, self.y0 + _divide_height + logical.get_y() + 2.0); /* 2 pixel padding below divider */
                        } else {
-                               cr->move_to (pos.x + 2.0, self.y0 + logical.get_y());
+                               cr->move_to (pos.x + 2.0, self.y0 + logical.get_y() + .5 * (height - logical.get_height()));
                        }
                        layout->show_in_cairo_context (cr);
                }
@@ -199,12 +198,12 @@ Ruler::render (Rect const & area, Cairo::RefPtr<Cairo::Context> cr) const
 
                cr->set_line_width (1.0);
 
-               set_source_rgba (cr, _divider_color_top);
+               Gtkmm2ext::set_source_rgba (cr, _divider_color_top);
                cr->move_to (self.x0, self.y0 + _divide_height-1.0+0.5);
                cr->line_to (self.x1, self.y0 + _divide_height-1.0+0.5);
                cr->stroke ();
 
-               set_source_rgba (cr, _divider_color_bottom);
+               Gtkmm2ext::set_source_rgba (cr, _divider_color_bottom);
                cr->move_to (self.x0, self.y0 + _divide_height+0.5);
                cr->line_to (self.x1, self.y0 + _divide_height+0.5);
                cr->stroke ();
@@ -222,7 +221,7 @@ Ruler::set_divide_height (double h)
 }
 
 void
-Ruler::set_divide_colors (Color t, Color b)
+Ruler::set_divide_colors (Gtkmm2ext::Color t, Gtkmm2ext::Color b)
 {
         _divider_color_bottom = b;
         _divider_color_top = t;