From c1905815521ea761f05af11e752c7f01f3bdb71d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 3 Jul 2018 12:39:56 -0400 Subject: [PATCH 1/1] fix rectangle computation, and re-use alex' color computation --- libs/canvas/note.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libs/canvas/note.cc b/libs/canvas/note.cc index c27a93985a..e79e30ee5b 100644 --- a/libs/canvas/note.cc +++ b/libs/canvas/note.cc @@ -19,6 +19,7 @@ #include #include "gtkmm2ext/colors.h" +#include "gtkmm2ext/rgb_macros.h" #include "canvas/note.h" #include "canvas/debug.h" @@ -58,18 +59,18 @@ Note::render (Rect const & area, Cairo::RefPtr context) const Rect self (item_to_window (Rectangle::get().translate (_position), false)); - if ((self.y1 - self.y0) < 5) { + if ((self.y1 - self.y0) < ((outline_width() * 2) + 1)) { /* not tall enough to show a velocity bar */ return; } - /* 2 pixel margin above and below - outline_width() margin on left - set width based on velocity + /* 2 pixel margin above and below (taking outline width into account). + outline_width() margin on left. + set width based on velocity. */ - self.y0 = self.y0 + 2; - self.y1 = self.y1 - 2; + self.y0 = self.y0 + outline_width() + 2; + self.y1 = self.y1 - outline_width() - 1; const double width = (self.x1 - self.x0) - (2 * outline_width()); self.x0 = self.x0 + outline_width(); self.x1 = self.x0 + (width * _velocity); @@ -90,5 +91,5 @@ void Note::set_fill_color (Gtkmm2ext::Color c) { Fill::set_fill_color (c); - _velocity_color = Gtkmm2ext::HSV (c).opposite().color (); + _velocity_color = UINT_INTERPOLATE (c, 0x000000ff, 0.5); } -- 2.30.2