From a7ce58b995a7ea0fbbc557fca16c372ce84a5c5f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 25 Feb 2021 17:59:53 +0100 Subject: [PATCH] Fix rec-ruler time display The calculation to round the distance to seconds has to be performed using floating point maths, not just the result being cast to double. The time-granularity must not be zero. --- gtk2_ardour/recorder_ui.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk2_ardour/recorder_ui.cc b/gtk2_ardour/recorder_ui.cc index 68663fee81..1ec5ebde36 100644 --- a/gtk2_ardour/recorder_ui.cc +++ b/gtk2_ardour/recorder_ui.cc @@ -1591,7 +1591,7 @@ RecorderUI::RecRuler::render (Cairo::RefPtr const& cr, cairo_rec const int n_labels = floor (width / (_time_width * 1.75)); const samplecnt_t time_span = _right - _left; - const samplecnt_t time_granularity = ceil ((double)(time_span / n_labels / _session->sample_rate ())) * _session->sample_rate (); + const samplecnt_t time_granularity = ceil ((double)time_span / n_labels / _session->sample_rate ()) * _session->sample_rate (); const double px_per_sample = width / (double) time_span; const samplepos_t lower = (_left / time_granularity) * time_granularity;