summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_summary.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2012-01-09 18:03:49 +0000
committerCarl Hetherington <carl@carlh.net>2012-01-09 18:03:49 +0000
commitb8a93d7a86bf8939a91c61d0dee05206d2ce2638 (patch)
treecff6cef934d7051f033dc951221ed324f782e49d /gtk2_ardour/editor_summary.cc
parent34373c30f3bdb8436d9f002b6cb9e1363346d6b5 (diff)
Don't redraw the summary every time the playhead moves (if it hasn't moved visibly on the summary), and only redraw the bit that has changed when it does happen.
git-svn-id: svn://localhost/ardour2/branches/3.0@11208 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_summary.cc')
-rw-r--r--gtk2_ardour/editor_summary.cc27
1 files changed, 23 insertions, 4 deletions
diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc
index 8de492ddec..57a08caf88 100644
--- a/gtk2_ardour/editor_summary.cc
+++ b/gtk2_ardour/editor_summary.cc
@@ -120,7 +120,7 @@ EditorSummary::on_expose_event (GdkEventExpose* event)
/* XXX: colour should be set from configuration file */
cairo_set_source_rgba (cr, 1, 0, 0, 1);
- double const p = (_editor->playhead_cursor->current_frame - _start) * _x_scale;
+ double const p = playhead_frame_to_position (_editor->playhead_cursor->current_frame);
cairo_move_to (cr, p, 0);
cairo_line_to (cr, p, get_height());
cairo_stroke (cr);
@@ -251,10 +251,19 @@ EditorSummary::render_region (RegionView* r, cairo_t* cr, double y) const
void
EditorSummary::set_overlays_dirty ()
{
- ENSURE_GUI_THREAD (*this, &EditorSummary::set_overlays_dirty)
+ ENSURE_GUI_THREAD (*this, &EditorSummary::set_overlays_dirty);
queue_draw ();
}
+/** Set the summary so that just the overlays (viewbox, playhead etc.) in a given area will be re-rendered */
+void
+EditorSummary::set_overlays_dirty (int x, int y, int w, int h)
+{
+ ENSURE_GUI_THREAD (*this, &EditorSummary::set_overlays_dirty);
+ queue_draw_area (x, y, w, h);
+}
+
+
/** Handle a size request.
* @param req GTK requisition
*/
@@ -859,8 +868,12 @@ EditorSummary::set_editor_y (pair<double, double> const y)
void
EditorSummary::playhead_position_changed (framepos_t p)
{
- if (_session && int (p * _x_scale) != int (_last_playhead)) {
- set_overlays_dirty ();
+ int const o = int (_last_playhead);
+ int const n = int (playhead_frame_to_position (p));
+ if (_session && o != n) {
+ int a = min (o, n);
+ int b = max (o, n);
+ set_overlays_dirty (a - 1, 0, b + 1, get_height ());
}
}
@@ -928,3 +941,9 @@ EditorSummary::route_gui_changed (string c)
set_dirty ();
}
}
+
+double
+EditorSummary::playhead_frame_to_position (framepos_t t) const
+{
+ return (t - _start) * _x_scale;
+}