[pitivi] viewer: Avoid snapping to imperfect sizes
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] viewer: Avoid snapping to imperfect sizes
- Date: Fri, 25 Jan 2019 21:36:11 +0000 (UTC)
commit e18adcac59b57eda98d68d281627fed2bc66a120
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Sun Jan 13 23:48:21 2019 +0100
viewer: Avoid snapping to imperfect sizes
We should not snap to 50% if the width and height are not divisible by
2.
pitivi/viewer/viewer.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/pitivi/viewer/viewer.py b/pitivi/viewer/viewer.py
index 5d1e1fe6..ae32d552 100644
--- a/pitivi/viewer/viewer.py
+++ b/pitivi/viewer/viewer.py
@@ -580,6 +580,12 @@ class ViewerWidget(Gtk.AspectFrame, Loggable):
self.videowidth = project.videowidth
self.videoheight = project.videoheight
+ self.snaps = []
+ for divisor in (16, 8, 4, 2):
+ if self.videowidth % divisor == 0 and self.videoheight % divisor == 0:
+ self.snaps.append(1 / divisor)
+ self.snaps += list(range(1, 10))
+
def do_get_preferred_width(self):
minimum, unused_natural = Gtk.AspectFrame.do_get_preferred_width(self)
# Do not let a chance for Gtk to choose video natural size
@@ -609,7 +615,7 @@ class ViewerWidget(Gtk.AspectFrame, Loggable):
# See if we want to snap the size of the child widget.
snap = 0
- for scale in (0.25, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10):
+ for scale in self.snaps:
if scale < current_scale < scale + 0.05:
snap = scale
break
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]