summaryrefslogtreecommitdiff
path: root/gtk2_ardour/tempo_curve.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-06-04 07:24:04 +1000
committernick_m <mainsbridge@gmail.com>2016-06-04 07:24:04 +1000
commitfa50cf50d10d8b1ab2e60bc145373791abb46db7 (patch)
treec2980b97046c34bb357110ce564679f8c737b239 /gtk2_ardour/tempo_curve.cc
parent56a5dd92af961797d771420aeaf6f9ab221864ec (diff)
Clamp tempo curve height.
Diffstat (limited to 'gtk2_ardour/tempo_curve.cc')
-rw-r--r--gtk2_ardour/tempo_curve.cc8
1 files changed, 4 insertions, 4 deletions
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);