[pitivi: 2/6] only redraw when scrolling or zooming



commit d761f5157dd409a3d9a3556d36774c40cb4d02d6
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Fri Oct 15 16:36:16 2010 +0100

    only redraw when scrolling or zooming

 pitivi/ui/ruler.py |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/ui/ruler.py b/pitivi/ui/ruler.py
index 5f411c3..72de79d 100644
--- a/pitivi/ui/ruler.py
+++ b/pitivi/ui/ruler.py
@@ -77,16 +77,17 @@ class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
         self.frame_height = 5.0
         self.frame_rate = gst.Fraction(1/1)
         self.app = instance
+        self.need_update = True
 
     def _hadjValueChangedCb(self, hadj):
         self.pixmap_offset = self.hadj.get_value()
+        self.need_update = True
         self.queue_draw()
 
 ## Zoomable interface override
 
     def zoomChanged(self):
-        self.queue_resize()
-        self.doPixmap()
+        self.need_update = True
         self.queue_draw()
 
 ## timeline position changed method
@@ -113,7 +114,9 @@ class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
         #     self.doPixmap()
         #     width = self.pixmap_allocated_width
 
-        self.doPixmap()
+        if self.need_update:
+            self.doPixmap()
+            self.need_update = False
 
         # double buffering power !
         self.window.draw_drawable(
@@ -214,11 +217,9 @@ class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
         self.scale[0] = float(2 / rate)
         self.scale[1] = float(5 / rate)
         self.scale[2] = float(10 / rate)
-        self.queue_resize()
 
     def setShadedDuration(self, duration):
         self.info("start/duration changed")
-        self.queue_resize()
 
         self.shaded_duration = duration
 
@@ -226,6 +227,8 @@ class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
             position = duration - gst.NSECOND
         else:
             position = self.position
+        self.need_update = True
+        self.queue_draw()
 
     def getShadedDuration(self):
         return self.shaded_duration
@@ -234,7 +237,6 @@ class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
         return self.nsToPixel(self.getShadedDuration())
 
     def setMaxDuration(self, duration):
-        self.queue_resize()
         self.max_duration = duration
 
     def drawBackground(self, allocation):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]