From fa50cf50d10d8b1ab2e60bc145373791abb46db7 Mon Sep 17 00:00:00 2001 From: nick_m Date: Sat, 4 Jun 2016 07:24:04 +1000 Subject: Clamp tempo curve height. --- gtk2_ardour/tempo_curve.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gtk2_ardour/tempo_curve.cc') diff --git a/gtk2_ardour/tempo_curve.cc b/gtk2_ardour/tempo_curve.cc index cac512c0b2..b8fb661919 100644 --- a/gtk2_ardour/tempo_curve.cc +++ b/gtk2_ardour/tempo_curve.cc @@ -133,17 +133,17 @@ TempoCurve::set_position (framepos_t frame, framepos_t end_frame) while (current_frame < (end_frame - frame_step)) { const double tempo_at = _tempo.tempo_at_frame (current_frame, editor.session()->frame_rate()) * _tempo.note_type(); - const double y_pos = (curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height); + const double y_pos = max ((curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height), 0.0); - points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (current_frame - frame), y_pos)); + points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (current_frame - frame), min (y_pos, curve_height))); current_frame += frame_step; } const double tempo_at = _tempo.tempo_at_frame (end_frame, editor.session()->frame_rate()) * _tempo.note_type(); - const double y_pos = (curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height); + const double y_pos = max ((curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height), 0.0); - points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel ((end_frame - 1) - frame), y_pos)); + points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel ((end_frame - 1) - frame), min (y_pos, curve_height))); } _curve->set (*points); -- cgit v1.2.3