[vlc-commits] vout: move zoom reduction

Rémi Denis-Courmont git at videolan.org
Thu Jan 24 18:02:29 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jan 24 18:50:45 2019 +0200| [86366778edc05eef9d600a86b3155a557344e31a] | committer: Rémi Denis-Courmont

vout: move zoom reduction

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=86366778edc05eef9d600a86b3155a557344e31a
---

 src/video_output/display.c       |  7 -------
 src/video_output/video_output.c  | 16 ++++++++++++----
 src/video_output/vout_internal.h |  2 +-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index 5093250c8b..de36bdd5b8 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -653,13 +653,6 @@ void vout_SetDisplayZoom(vout_display_t *vd, unsigned num, unsigned den)
 {
     vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
 
-    if (num != 0 && den != 0) {
-        vlc_ureduce(&num, &den, num, den, 0);
-    } else {
-        num = 1;
-        den = 1;
-    }
-
     if (10 * num <= den) {
         num = 1;
         den = 10;
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 7f8127ca8e..13e700ad1f 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -560,13 +560,21 @@ void vout_ControlChangeDisplayFilled(vout_thread_t *vout, bool is_filled)
                           is_filled);
 }
 
-void vout_ControlChangeZoom(vout_thread_t *vout, int num, int den)
+void vout_ControlChangeZoom(vout_thread_t *vout, unsigned num, unsigned den)
 {
+    if (num != 0 && den != 0) {
+        vlc_ureduce(&num, &den, num, den, 0);
+    } else {
+        num = 1;
+        den = 1;
+    }
+
     if (num * 10 < den) {
-        num = den;
-        den *= 10;
+        num = 1;
+        den = 10;
     } else if (num > den * 10) {
-        num = den * 10;
+        num = 10;
+        den = 1;
     }
 
     vout_ControlUpdateWindowSize(vout);
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 991fc695a9..29ecfc44ce 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -188,7 +188,7 @@ void vout_ControlChangeWindowState(vout_thread_t *, unsigned state);
 void vout_ControlChangeDisplaySize(vout_thread_t *,
                                    unsigned width, unsigned height);
 void vout_ControlChangeDisplayFilled(vout_thread_t *, bool is_filled);
-void vout_ControlChangeZoom(vout_thread_t *, int num, int den);
+void vout_ControlChangeZoom(vout_thread_t *, unsigned num, unsigned den);
 void vout_ControlChangeSampleAspectRatio(vout_thread_t *, unsigned num, unsigned den);
 void vout_ControlChangeCropRatio(vout_thread_t *, unsigned num, unsigned den);
 void vout_ControlChangeCropWindow(vout_thread_t *, int x, int y, int width, int height);



More information about the vlc-commits mailing list