[pitivi] elements: Remove margins between clips



commit d9ea4348ac41a7e87888d93039f680634efeeccd
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Fri Jan 10 01:26:13 2014 +0100

    elements: Remove margins between clips
    
    The 1px margins can be caused by rounding errors.

 pitivi/timeline/elements.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 807534c..14cb614 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -529,8 +529,13 @@ class TimelineElement(Clutter.Actor, Zoomable):
     # private API
 
     def update(self, ease):
-        size = self.bElement.get_duration()
-        self.set_size(self.nsToPixel(size), EXPANDED_SIZE, ease)
+        start = self.bElement.get_start()
+        duration = self.bElement.get_duration()
+        # The calculation of the duration assumes that the start is always
+        # int(pixels_float). In that case, the rounding can add up and a pixel
+        # might be lost if we ignore the start of the clip.
+        size = self.nsToPixel(start + duration) - self.nsToPixel(start)
+        self.set_size(size, EXPANDED_SIZE, ease)
 
     def setDragged(self, dragged):
         brother = self.timeline.findBrother(self.bElement)


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