diff options
author | André Nusser <andre.nusser@googlemail.com> | 2015-12-01 00:15:53 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-01-12 13:45:38 +0100 |
commit | 39bd216725668390534789a895cacf4ee070531f (patch) | |
tree | 32b8dca80b7ba2e23e137c217ad57a5a71758312 /gtk2_ardour/midi_streamview.cc | |
parent | 76237a696cee8125102c161a210a22fdf484fc3b (diff) |
Fix two ghost note drawing problems.
A ghost note could appear:
1) above the region.
2) inside another note even though we haven't yet entered it.
Diffstat (limited to 'gtk2_ardour/midi_streamview.cc')
-rw-r--r-- | gtk2_ardour/midi_streamview.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index ce34fb9b88..9258cf027d 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -619,7 +619,7 @@ MidiStreamView::update_rec_box () uint8_t MidiStreamView::y_to_note (double y) const { - int const n = ((contents_height() - y - 1) / contents_height() * (double)contents_note_range()) + int const n = ((contents_height() - y) / contents_height() * (double)contents_note_range()) + lowest_note(); if (n < 0) { @@ -628,7 +628,8 @@ MidiStreamView::y_to_note (double y) const return 127; } - return n; + /* min due to rounding and/or off-by-one errors */ + return min ((uint8_t) n, highest_note()); } /** Suspend updates to the regions' note ranges and our |