diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2018-07-03 12:39:56 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2018-07-03 12:39:56 -0400 |
commit | c1905815521ea761f05af11e752c7f01f3bdb71d (patch) | |
tree | ba0da667034d7e7ab2f45ac3948394e984d4728d /libs/canvas | |
parent | 21582828b7574592a17727a68f163d2d6ef4eb9b (diff) |
fix rectangle computation, and re-use alex' color computation
Diffstat (limited to 'libs/canvas')
-rw-r--r-- | libs/canvas/note.cc | 15 |
1 files 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 <cairomm/context.h> #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<Cairo::Context> 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); } |