From fd48e72fc212a0f7a2cb23a7c39ccc0f76cb7439 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 27 Dec 2011 00:22:26 +0000 Subject: [PATCH] Fix comparison of beats to frames when deciding whether to show a patch change (should fix #4569). git-svn-id: svn://localhost/ardour2/branches/3.0@11085 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/midi_region_view.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 6b65bb26b8..43532f145c 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -1677,7 +1677,8 @@ MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const { assert (patch->time() >= 0); - const double x = trackview.editor().frame_to_pixel (source_beats_to_region_frames (patch->time())); + framecnt_t region_frames = source_beats_to_region_frames (patch->time()); + const double x = trackview.editor().frame_to_pixel (region_frames); double const height = midi_stream_view()->contents_height(); @@ -1692,7 +1693,7 @@ MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const ); // Show unless patch change is beyond the region bounds - if (patch->time() - _region->start() >= _region->length() || patch->time() < _region->start()) { + if (region_frames < 0 || region_frames >= _region->length()) { patch_change->hide(); } else { patch_change->show(); -- 2.30.2