From 272df0ac58e848f02e1ef47306426d7b5ad696f8 Mon Sep 17 00:00:00 2001 From: Mads Kiilerich Date: Thu, 6 Oct 2022 22:37:08 +0200 Subject: [PATCH] ArdourGraphs::time_axis : Introduce a constant label_pos --- gtk2_ardour/export_analysis_graphs.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/export_analysis_graphs.cc b/gtk2_ardour/export_analysis_graphs.cc index 45d231e575..c734ed7f91 100644 --- a/gtk2_ardour/export_analysis_graphs.cc +++ b/gtk2_ardour/export_analysis_graphs.cc @@ -496,6 +496,7 @@ ArdourGraphs::time_axis (Glib::RefPtr pctx, int width, int m_l, for (int i = 0; i <= n_labels; ++i) { const float fract = (float)i / n_labels; + const int label_pos = width * fract; const float xalign = (i == n_labels) ? 1.f : (i == 0) ? 0 : .5f; char buf[16]; @@ -503,15 +504,15 @@ ArdourGraphs::time_axis (Glib::RefPtr pctx, int width, int m_l, layout->set_text (&buf[1]); layout->get_pixel_size (w, h); - cr->move_to (rint (m_l + width * fract - w * xalign), rint (.5 * (height - h))); + cr->move_to (rint (m_l + label_pos - w * xalign), rint (.5 * (height - h))); cr->set_source_rgba (.9, .9, .9, 1.0); layout->show_in_cairo_context (cr); cr->set_source_rgba (.7, .7, .7, 1.0); - cr->move_to (rint (m_l + width * fract) - .5, 0); - cr->line_to (rint (m_l + width * fract) - .5, ceil (height * .15)); - cr->move_to (rint (m_l + width * fract) - .5, floor (height * .85)); - cr->line_to (rint (m_l + width * fract) - .5, height); + cr->move_to (rint (m_l + label_pos) - .5, 0); + cr->line_to (rint (m_l + label_pos) - .5, ceil (height * .15)); + cr->move_to (rint (m_l + label_pos) - .5, floor (height * .85)); + cr->line_to (rint (m_l + label_pos) - .5, height); cr->stroke (); }