Partial exposure of export-audition playhead
authorRobin Gareus <robin@gareus.org>
Fri, 12 Feb 2016 22:01:10 +0000 (23:01 +0100)
committerRobin Gareus <robin@gareus.org>
Fri, 12 Feb 2016 22:01:10 +0000 (23:01 +0100)
gtk2_ardour/export_report.h

index 06c6076dff8b923817e456de39ab819ffb6dedee..ba83343eda4b22cb7cefae1f87bc083e7ff0dc60 100644 (file)
@@ -63,10 +63,16 @@ public:
        }
 
        void set_playhead (float pos) {
-               // TODO re-expose minimal area only, old playhead pos, new playead pos
-               if (_playhead == pos) { return; }
+               if (rint (_playhead * _aw) == rint (pos * _aw)) {
+                       return;
+               }
+               if (_playhead == -1 || pos == -1) {
+                       set_dirty ();
+               } else {
+                       invalidate (_playhead);
+                       invalidate (pos);
+               }
                _playhead = pos;
-               set_dirty ();
        }
 
        void set_audition_axis (float x0, float w) {
@@ -78,6 +84,17 @@ private:
        Cairo::RefPtr<Cairo::ImageSurface> _surface;
        float _playhead;
        float _x0, _aw;
+
+       void invalidate (float pos) {
+               if (pos < 0 || pos > 1) { return; }
+               const float x = pos * _aw;
+               cairo_rectangle_t r;
+               r.y = 0;
+               r.x = _x0 + x - 1;
+               r.width = 3;
+               r.height = _surface->get_height();
+               set_dirty (&r);
+       }
 };
 
 class ExportReport : public ArdourDialog