From 85375397ede8f43605e4578b4e38d43548ab9636 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 11 Sep 2023 14:04:59 -0600 Subject: [PATCH] fix semi-random MIDI note separator line vanishing --- gtk2_ardour/midi_streamview.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index 5d4438df99..c0c648c953 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -331,7 +331,7 @@ MidiStreamView::draw_note_lines() } double y; - double prev_y = .5; + double prev_y = 0.; uint32_t color; ArdourCanvas::LineSet::ResetRAII lr (*_note_lines); @@ -347,7 +347,7 @@ MidiStreamView::draw_note_lines() for (int i = highest_note() + 1; i >= lowest_note(); --i) { - y = floor(note_to_y (i)) + .5; + y = floor (note_to_y (i)); /* this is the line actually corresponding to the division * between notes @@ -377,6 +377,14 @@ MidiStreamView::draw_note_lines() double h = y - prev_y; double mid = y + (h/2.0); + /* Cairo: odd width lines must be placed on 0.5 coordinates to be + * drawn correctly. + */ + + if (!fmod (h, 2.) && !fmod (mid, 1.)) { + mid += 0.5; + } + if (mid >= 0 && h > 1.0) { _note_lines->add_coord (mid, h, color); }