From 2d31fa7bb10c7d0dfa7950e35ef61b00390b4546 Mon Sep 17 00:00:00 2001 From: nick_m Date: Wed, 25 May 2016 12:31:17 +1000 Subject: Tempo ramps - finally fix flicker in framed curve. --- libs/canvas/framed_curve.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libs/canvas') diff --git a/libs/canvas/framed_curve.cc b/libs/canvas/framed_curve.cc index 295deb8dad..6bd2f740b0 100644 --- a/libs/canvas/framed_curve.cc +++ b/libs/canvas/framed_curve.cc @@ -187,22 +187,25 @@ FramedCurve::render (Rect const & area, Cairo::RefPtr context) c Points::size_type left = 0; Points::size_type right = n_samples; - for (Points::size_type idx = 0; idx < n_samples - 1; ++idx) { + for (Points::size_type idx = 0; idx < n_samples; ++idx) { window_space = item_to_window (Duple (samples[idx].x, 0.0)); if (window_space.x >= draw.x0) break; left = idx; } - for (Points::size_type idx = n_samples; idx > left; --idx) { + for (Points::size_type idx = n_samples; idx > left + 2; --idx) { window_space = item_to_window (Duple (samples[idx].x, 0.0)); if (window_space.x <= draw.x1) break; right = idx; } + window_space = item_to_window (*_points.begin()); + context->move_to (window_space.x, window_space.y); /* draw line between samples */ window_space = item_to_window (Duple (samples[left].x, samples[left].y)); - context->move_to (window_space.x, window_space.y); - for (uint32_t idx = left + 1; idx < right; ++idx) { + context->line_to (window_space.x, window_space.y); + + for (uint32_t idx = left; idx < right; ++idx) { window_space = item_to_window (Duple (samples[idx].x, samples[idx].y), false); context->line_to (window_space.x, window_space.y); } -- cgit v1.2.3