Fix comparison of beats to frames when deciding whether to show a patch change (shoul...
authorCarl Hetherington <carl@carlh.net>
Tue, 27 Dec 2011 00:22:26 +0000 (00:22 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 27 Dec 2011 00:22:26 +0000 (00:22 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@11085 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/midi_region_view.cc

index 6b65bb26b82f08d3c57b4c3e5548b97f8405a17f..43532f145c081af285e6c2653462dd934e6123ae 100644 (file)
@@ -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();