summaryrefslogtreecommitdiff
path: root/GstDebugViewer
diff options
context:
space:
mode:
authorRené Stadler <mail@renestadler.de>2012-09-22 01:27:37 +0200
committerRené Stadler <mail@renestadler.de>2012-09-22 01:27:37 +0200
commitc7f03f8657ef9bdf550c52b567e1c9454fdbae7a (patch)
tree83e93273d6ff956e383f4cb0296070c9199ac993 /GstDebugViewer
parentd208fb71b0d111eab7a223b0698d6d3f58179827 (diff)
timeline: only redraw required areas when updating position rectangle
Diffstat (limited to 'GstDebugViewer')
-rw-r--r--GstDebugViewer/Plugins/Timeline.py33
1 files changed, 25 insertions, 8 deletions
diff --git a/GstDebugViewer/Plugins/Timeline.py b/GstDebugViewer/Plugins/Timeline.py
index f69aa4d..9566ea1 100644
--- a/GstDebugViewer/Plugins/Timeline.py
+++ b/GstDebugViewer/Plugins/Timeline.py
@@ -552,15 +552,23 @@ class TimelineWidget (gtk.DrawingArea):
def update_position (self, start_ts, end_ts):
- self.__position_ts_range = (start_ts, end_ts,)
-
if not self.process.freq_sentinel:
return
if not self.process.freq_sentinel.data:
return
- self.queue_draw ()
+ x, y, width, height = self.get_allocation ()
+
+ # Queue old position rectangle for redraw:
+ if self.__position_ts_range is not None:
+ start, stop = self.ts_range_to_position (*self.__position_ts_range)
+ self.queue_draw_area (start - 1, 0, stop - start + 2, height)
+ # And the new one:
+ start, stop = self.ts_range_to_position (start_ts, end_ts)
+ self.queue_draw_area (start - 1, 0, stop - start + 2, height)
+
+ self.__position_ts_range = (start_ts, end_ts,)
def find_indicative_time_step (self):
@@ -700,20 +708,29 @@ class TimelineWidget (gtk.DrawingArea):
else:
return False
- def __draw_position (self, drawable, clip = None):
+ def ts_range_to_position (self, start_ts, end_ts):
if not self.__have_position ():
- return
+ return (0, 0)
- start_ts, end_ts = self.__position_ts_range
first_ts, last_ts = self.process.freq_sentinel.ts_range
step = self.process.freq_sentinel.step
if step == 0:
- return
+ return (0, 0)
position1 = int (float (start_ts - first_ts) / step)
position2 = int (float (end_ts - first_ts) / step)
+ return (position1, position2)
+
+ def __draw_position (self, drawable, clip = None):
+
+ if not self.__have_position ():
+ return
+
+ start_ts, end_ts = self.__position_ts_range
+ position1, position2 = self.ts_range_to_position (start_ts, end_ts)
+
if clip:
clip_x, clip_y, clip_w, clip_h = clip
if clip_x + clip_w < position1 - 1 or clip_x > position2 + 1:
@@ -743,7 +760,7 @@ class TimelineWidget (gtk.DrawingArea):
if self.__offscreen is None:
self.__update_offscreen ()
- self.__draw_from_offscreen ()
+ self.__draw_from_offscreen (event.area)
return True