[vlc-commits] display: make zoom unsigned

Rémi Denis-Courmont git at videolan.org
Sun May 20 19:51:58 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri May 18 23:44:18 2018 +0300| [073bdc142aa68110d53ddddba25e4dd01d690f02] | committer: Rémi Denis-Courmont

display: make zoom unsigned

The fraction is reduced, so the denominator cannot be negative.

As far as maths are concerned, a negative zoom means the image is
rotated 180 degrees. But we already have orientation to deal with that.
So forbid negative numerator too.

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

 include/vlc_vout_display.h      | 4 ++--
 src/video_output/video_output.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 33b8d438e6..7023057233 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -94,8 +94,8 @@ typedef struct {
      * It will be applied to the whole display if b_display_filled is set, otherwise
      * only on the video source */
     struct {
-        int num;
-        int den;
+        unsigned num;
+        unsigned den;
     } zoom;
 
     vlc_viewpoint_t viewpoint;
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 96f8028f1b..6acaa95d75 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1638,7 +1638,7 @@ static int ThreadReinit(vout_thread_t *vout,
         state.cfg.display.sar.num = 1;
         state.cfg.display.sar.den = 1;
     }
-    if (state.cfg.zoom.num <= 0 || state.cfg.zoom.den <= 0) {
+    if (state.cfg.zoom.num == 0 || state.cfg.zoom.den == 0) {
         state.cfg.zoom.num = 1;
         state.cfg.zoom.den = 1;
     }



More information about the vlc-commits mailing list