Trim note display to not overlap the end of its region. Should fix #3202 and #2143.
authorCarl Hetherington <carl@carlh.net>
Thu, 22 Jul 2010 01:45:52 +0000 (01:45 +0000)
committerCarl Hetherington <carl@carlh.net>
Thu, 22 Jul 2010 01:45:52 +0000 (01:45 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7466 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/midi_region_view.cc

index 25254e6bc2b30eb630341c27a8c40f2bc93cc06a..9f67dc89baca3013af746611f4e17edb9535416f 100644 (file)
@@ -1335,7 +1335,9 @@ MidiRegionView::update_note (CanvasNote* ev)
        boost::shared_ptr<NoteType> note = ev->note();
 
        const nframes64_t note_start_frames = beats_to_frames(note->time());
-       const nframes64_t note_end_frames   = beats_to_frames(note->end_time());
+
+       /* trim note display to not overlap the end of its region */
+       const nframes64_t note_end_frames = min (beats_to_frames (note->end_time()), _region->start() + _region->length());
 
        const double x = trackview.editor().frame_to_pixel(note_start_frames - _region->start());
        const double y1 = midi_stream_view()->note_to_y(note->note());