From f88cfdb47802241c306273d98f31538d44e6781a Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 20 Apr 2013 16:11:30 -0400 Subject: [PATCH] remove Editor::redraw_measures to improve efficiency of tempo measure line redraws --- gtk2_ardour/editor.cc | 8 ++++++- gtk2_ardour/editor.h | 1 - gtk2_ardour/editor_tempodisplay.cc | 36 +++++++++--------------------- gtk2_ardour/public_editor.h | 1 - 4 files changed, 17 insertions(+), 29 deletions(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 96edd51af6..d458b41b84 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -3725,8 +3725,14 @@ Editor::set_show_measures (bool yn) if (tempo_lines) { tempo_lines->show(); } - (void) redraw_measures (); + + ARDOUR::TempoMap::BBTPointList::const_iterator begin; + ARDOUR::TempoMap::BBTPointList::const_iterator end; + + compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(), begin, end); + draw_measures (begin, end); } + instant_save (); } } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 768e524e3a..160400c22b 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1489,7 +1489,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void hide_measures (); void draw_measures (ARDOUR::TempoMap::BBTPointList::const_iterator& begin, ARDOUR::TempoMap::BBTPointList::const_iterator& end); - bool redraw_measures (); void new_tempo_section (); diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 4eb43ad53b..09d9b39c73 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -119,7 +119,7 @@ Editor::tempo_map_changed (const PropertyChange& /*ignored*/) compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(), begin, end); _session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers - redraw_measures (); + draw_measures (begin, end); update_tempo_based_rulers (begin, end); } @@ -130,22 +130,18 @@ Editor::redisplay_tempo (bool immediate_redraw) return; } - ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin; - ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end; - - compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(), - current_bbt_points_begin, current_bbt_points_end); - if (immediate_redraw) { - redraw_measures (); + ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin; + ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end; + + compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(), + current_bbt_points_begin, current_bbt_points_end); + draw_measures (current_bbt_points_begin, current_bbt_points_end); + update_tempo_based_rulers (current_bbt_points_begin, current_bbt_points_end); // redraw rulers and measures + } else { -#ifdef GTKOSX - redraw_measures (); -#else - Glib::signal_idle().connect (sigc::mem_fun (*this, &Editor::redraw_measures)); -#endif + Glib::signal_idle().connect (sigc::bind_return (sigc::bind (sigc::mem_fun (*this, &Editor::redisplay_tempo), true), false)); } - update_tempo_based_rulers (current_bbt_points_begin, current_bbt_points_end); // redraw rulers and measures } void @@ -170,18 +166,6 @@ Editor::hide_measures () tempo_lines->hide(); } -bool -Editor::redraw_measures () -{ - ARDOUR::TempoMap::BBTPointList::const_iterator begin; - ARDOUR::TempoMap::BBTPointList::const_iterator end; - - compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(), begin, end); - draw_measures (begin, end); - - return false; -} - void Editor::draw_measures (ARDOUR::TempoMap::BBTPointList::const_iterator& begin, ARDOUR::TempoMap::BBTPointList::const_iterator& end) diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 12f4cd0ec7..d95b29d814 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -212,7 +212,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible { virtual void maybe_locate_with_edit_preroll (framepos_t location) = 0; virtual void set_show_measures (bool yn) = 0; virtual bool show_measures () const = 0; - virtual bool redraw_measures () = 0; virtual Editing::MouseMode effective_mouse_mode () const = 0;