[vlc-commits] vout: drop last parameter of vout_display_PlacePicture()

Rémi Denis-Courmont git at videolan.org
Mon Dec 17 22:12:53 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 17 23:04:36 2018 +0200| [80fa0863c4244bd9475f60a838d39ad331cee06a] | committer: Rémi Denis-Courmont

vout: drop last parameter of vout_display_PlacePicture()

Clipping the picture place computes incorrect values, which cannot be
used for correct rendering. Instead the place should never be clipped,
and the picture should be cropped if one or both coordinates are
negative, or one or both dimensions exceeds the display dimensions.

Fortunately, only one video output used the broken mode.

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

 include/vlc_vout_display.h              | 3 +--
 modules/hw/mmal/vout.c                  | 4 ++--
 modules/hw/vdpau/display.c              | 6 +++---
 modules/video_output/caca.c             | 2 +-
 modules/video_output/caopengllayer.m    | 2 +-
 modules/video_output/ios.m              | 2 +-
 modules/video_output/kva.c              | 2 +-
 modules/video_output/macosx.m           | 4 ++--
 modules/video_output/opengl/display.c   | 4 ++--
 modules/video_output/vulkan/display.c   | 2 +-
 modules/video_output/wayland/shm.c      | 4 ++--
 modules/video_output/win32/common.c     | 2 +-
 modules/video_output/win32/directdraw.c | 2 +-
 modules/video_output/win32/events.c     | 2 +-
 modules/video_output/xcb/x11.c          | 4 ++--
 modules/video_output/xcb/xvideo.c       | 7 +++----
 src/video_output/display.c              | 8 +-------
 src/video_output/video_output.c         | 4 ++--
 18 files changed, 28 insertions(+), 36 deletions(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 0ca8f3cfe1..d37b05b8af 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -393,9 +393,8 @@ typedef struct {
  * \param p_place Place inside the window (window pixel unit)
  * \param p_source Video source format
  * \param p_cfg Display configuration
- * \param b_clip If true, prevent the video to go outside the display (break zoom).
  */
-VLC_API void vout_display_PlacePicture(vout_display_place_t *place, const video_format_t *source, const vout_display_cfg_t *cfg, bool do_clipping);
+VLC_API void vout_display_PlacePicture(vout_display_place_t *place, const video_format_t *source, const vout_display_cfg_t *cfg);
 
 
 /**
diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index 85210be407..42da7229cd 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -258,7 +258,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     }
     sys->input->buffer_size = sys->input->buffer_size_recommended;
 
-    vout_display_PlacePicture(&place, &vd->source, cfg, false);
+    vout_display_PlacePicture(&place, &vd->source, cfg);
     display_region.hdr.id = MMAL_PARAMETER_DISPLAYREGION;
     display_region.hdr.size = sizeof(MMAL_DISPLAYREGION_T);
     display_region.fullscreen = MMAL_FALSE;
@@ -413,7 +413,7 @@ static int configure_display(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if (!cfg)
         cfg = &sys->last_cfg;
 
-    vout_display_PlacePicture(&place, fmt, cfg, false);
+    vout_display_PlacePicture(&place, fmt, cfg);
 
     display_region.hdr.id = MMAL_PARAMETER_DISPLAYREGION;
     display_region.hdr.size = sizeof(MMAL_DISPLAYREGION_T);
diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index 63ae458a65..43ddb71ede 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -344,7 +344,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
         const video_format_t *src= &vd->source;
         vout_display_place_t place;
 
-        vout_display_PlacePicture(&place, src, cfg, false);
+        vout_display_PlacePicture(&place, src, cfg);
 
         fmt->i_width = src->i_width * place.width / src->i_visible_width;
         fmt->i_height = src->i_height * place.height / src->i_visible_height;
@@ -366,7 +366,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
         const vout_display_cfg_t *cfg = va_arg(ap, const vout_display_cfg_t *);
         vout_display_place_t place;
 
-        vout_display_PlacePicture(&place, &vd->source, cfg, false);
+        vout_display_PlacePicture(&place, &vd->source, cfg);
         if (place.width  != vd->fmt.i_visible_width
          || place.height != vd->fmt.i_visible_height)
         {
@@ -582,7 +582,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         };
         vout_display_place_t place;
 
-        vout_display_PlacePicture (&place, &vd->source, cfg, false);
+        vout_display_PlacePicture(&place, &vd->source, cfg);
         sys->window = xcb_generate_id(sys->conn);
 
         xcb_void_cookie_t c =
diff --git a/modules/video_output/caca.c b/modules/video_output/caca.c
index 1dfdc49f68..e2868f0d22 100644
--- a/modules/video_output/caca.c
+++ b/modules/video_output/caca.c
@@ -96,7 +96,7 @@ static void Place(vout_display_t *vd, const vout_display_cfg_t *cfg)
 {
     vout_display_sys_t *sys = vd->sys;
 
-    vout_display_PlacePicture(&sys->place, &vd->source, cfg, false);
+    vout_display_PlacePicture(&sys->place, &vd->source, cfg);
 
     const int canvas_width   = cucul_get_canvas_width(sys->cv);
     const int canvas_height  = cucul_get_canvas_height(sys->cv);
diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index 0bbc07ee2f..44c8ded967 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -346,7 +346,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
                 cfg_tmp.align.vertical = VLC_VIDEO_ALIGN_TOP;
 
             vout_display_place_t place;
-            vout_display_PlacePicture (&place, &vd->source, &cfg_tmp, false);
+            vout_display_PlacePicture(&place, &vd->source, &cfg_tmp);
             if (OpenglLock(sys->gl))
                 return VLC_EGENERIC;
 
diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index 45041bfb3a..38d789bbaf 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -672,7 +672,7 @@ static void GLESSwap(vlc_gl_t *gl)
     cfg.display.width  = _viewSize.width * _scaleFactor;
     cfg.display.height = _viewSize.height * _scaleFactor;
 
-    vout_display_PlacePicture(place, &_voutDisplay->source, &cfg, false);
+    vout_display_PlacePicture(place, &_voutDisplay->source, &cfg);
 }
 
 - (void)reshape
diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
index e13f91beb8..0995fa8ce2 100644
--- a/modules/video_output/kva.c
+++ b/modules/video_output/kva.c
@@ -455,7 +455,7 @@ static int Control( vout_display_t *vd, int query, va_list args )
         if( query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT )
         {
             vout_display_place_t place;
-            vout_display_PlacePicture(&place, &vd->source, vd->cfg, false);
+            vout_display_PlacePicture(&place, &vd->source, vd->cfg);
 
             sys->kvas.ulAspectWidth  = place.width;
             sys->kvas.ulAspectHeight = place.height;
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 27d1b2503e..eb25ea29e2 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -380,7 +380,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
                     cfg_tmp.align.vertical = VLC_VIDEO_ALIGN_TOP;
 
                 vout_display_place_t place;
-                vout_display_PlacePicture (&place, &vd->source, &cfg_tmp, false);
+                vout_display_PlacePicture(&place, &vd->source, &cfg_tmp);
                 @synchronized (sys->glView) {
                     sys->place = place;
                     sys->cfg = *cfg;
@@ -644,7 +644,7 @@ static void OpenglSwap (vlc_gl_t *gl)
             sys->cfg.display.width  = bounds.size.width;
             sys->cfg.display.height = bounds.size.height;
 
-            vout_display_PlacePicture (&sys->place, &vd->source, &sys->cfg, false);
+            vout_display_PlacePicture(&sys->place, &vd->source, &sys->cfg);
             vout_window_ReportSize(sys->embed, bounds.size.width, bounds.size.height);
             place = sys->place;
         }
diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index cae5623907..eb945aea3f 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -243,7 +243,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
         else if (c.align.vertical == VLC_VIDEO_ALIGN_BOTTOM)
             c.align.vertical = VLC_VIDEO_ALIGN_TOP;
 
-        vout_display_PlacePicture (&place, src, &c, false);
+        vout_display_PlacePicture(&place, src, &c);
         vlc_gl_Resize (sys->gl, c.display.width, c.display.height);
         if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
             return VLC_EGENERIC;
@@ -259,7 +259,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
         const vout_display_cfg_t *cfg = va_arg (ap, const vout_display_cfg_t *);
         vout_display_place_t place;
 
-        vout_display_PlacePicture (&place, &vd->source, cfg, false);
+        vout_display_PlacePicture(&place, &vd->source, cfg);
         if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
             return VLC_EGENERIC;
         vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height);
diff --git a/modules/video_output/vulkan/display.c b/modules/video_output/vulkan/display.c
index e836be005d..6250fba3c2 100644
--- a/modules/video_output/vulkan/display.c
+++ b/modules/video_output/vulkan/display.c
@@ -527,7 +527,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
     case VOUT_DISPLAY_CHANGE_ZOOM: {
         vout_display_cfg_t cfg = *va_arg (ap, const vout_display_cfg_t *);
-        vout_display_PlacePicture(&sys->place, &vd->source, &cfg, false);
+        vout_display_PlacePicture(&sys->place, &vd->source, &cfg);
         return VLC_SUCCESS;
     }
 
diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c
index ac881fcf8f..cf63455cfb 100644
--- a/modules/video_output/wayland/shm.c
+++ b/modules/video_output/wayland/shm.c
@@ -170,7 +170,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
             video_format_t src;
             assert(sys->viewport == NULL);
 
-            vout_display_PlacePicture(&place, &vd->source, cfg, false);
+            vout_display_PlacePicture(&place, &vd->source, cfg);
             video_format_ApplyRotation(&src, &vd->source);
 
             fmt->i_width  = src.i_width * place.width
@@ -202,7 +202,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
                 vout_display_place_t place;
 
                 video_format_ApplyRotation(&fmt, &vd->source);
-                vout_display_PlacePicture(&place, &vd->source, cfg, false);
+                vout_display_PlacePicture(&place, &vd->source, cfg);
 
                 wp_viewport_set_source(sys->viewport,
                                 wl_fixed_from_int(fmt.i_x_offset),
diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index b04ebbb47d..e99f4a4d2e 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -216,7 +216,7 @@ void UpdateRects(vout_display_t *vd, bool is_forced)
 #endif
 
     vout_display_place_t place;
-    vout_display_PlacePicture(&place, source, &place_cfg, false);
+    vout_display_PlacePicture(&place, source, &place_cfg);
 
 #if !VLC_WINSTORE_APP
     if (!sys->b_windowless)
diff --git a/modules/video_output/win32/directdraw.c b/modules/video_output/win32/directdraw.c
index 7b1076efd3..2c68337ec2 100644
--- a/modules/video_output/win32/directdraw.c
+++ b/modules/video_output/win32/directdraw.c
@@ -1361,7 +1361,7 @@ static int DirectXUpdateOverlay(vout_display_t *vd, LPDIRECTDRAWSURFACE2 surface
         cfg.display.height = sys->sys.rect_display.bottom;
 
         vout_display_place_t place;
-        vout_display_PlacePicture(&place, &vd->source, &cfg, false);
+        vout_display_PlacePicture(&place, &vd->source, &cfg);
 
         if (place.x < 0) {
             place.width += -place.x;
diff --git a/modules/video_output/win32/events.c b/modules/video_output/win32/events.c
index 0dfa779bae..b4df31da89 100644
--- a/modules/video_output/win32/events.c
+++ b/modules/video_output/win32/events.c
@@ -485,7 +485,7 @@ event_thread_t *EventThreadCreate( vout_display_t *vd, const vout_display_cfg_t
     p_event->source = vd->source;
     p_event->hwnd = NULL;
     atomic_init(&p_event->has_moved, false);
-    vout_display_PlacePicture(&p_event->place, &vd->source, vdcfg, false);
+    vout_display_PlacePicture(&p_event->place, &vd->source, vdcfg);
 
     _sntprintf( p_event->class_main, sizeof(p_event->class_main)/sizeof(*p_event->class_main),
                _T("VLC video main %p"), (void *)p_event );
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 034b9f7ca7..f5ee7d2d7f 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -160,7 +160,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
         video_format_t src, *fmt = &sys->fmt;
         vout_display_place_t place;
 
-        vout_display_PlacePicture(&place, &vd->source, cfg, false);
+        vout_display_PlacePicture(&place, &vd->source, cfg);
 
         uint32_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y;
         const uint32_t values[] = {
@@ -396,7 +396,7 @@ found_format:;
     };
     vout_display_place_t place;
 
-    vout_display_PlacePicture(&place, &vd->source, cfg, false);
+    vout_display_PlacePicture(&place, &vd->source, cfg);
     sys->window = xcb_generate_id (conn);
     sys->gc = xcb_generate_id (conn);
 
diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index 6753f5247f..874da65609 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -402,7 +402,7 @@ static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
     video_format_t fmt;
 
     p_sys->port = 0;
-    vout_display_PlacePicture (&p_sys->place, &vd->source, cfg, false);
+    vout_display_PlacePicture(&p_sys->place, &vd->source, cfg);
 
     xcb_xv_adaptor_info_iterator_t it;
     for (it = xcb_xv_query_adaptors_info_iterator (adaptors);
@@ -711,9 +711,8 @@ static int Control (vout_display_t *vd, int query, va_list ap)
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
     {
-        vout_display_PlacePicture (&p_sys->place, &vd->source,
-                                   va_arg(ap, const vout_display_cfg_t *),
-                                   false);
+        vout_display_PlacePicture(&p_sys->place, &vd->source,
+                                  va_arg(ap, const vout_display_cfg_t *));
 
         /* Move the picture within the window */
         const uint32_t values[] = { p_sys->place.x, p_sys->place.y,
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 3d42a380e6..f8a70c83a0 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -210,8 +210,7 @@ void vout_display_GetDefaultDisplaySize(unsigned *width, unsigned *height,
 /* */
 void vout_display_PlacePicture(vout_display_place_t *place,
                                const video_format_t *source,
-                               const vout_display_cfg_t *cfg,
-                               bool do_clipping)
+                               const vout_display_cfg_t *cfg)
 {
     /* */
     memset(place, 0, sizeof(*place));
@@ -236,11 +235,6 @@ void vout_display_PlacePicture(vout_display_place_t *place,
         cfg_tmp.display.height = 0;
         vout_display_GetDefaultDisplaySize(&display_width, &display_height,
                                            source, &cfg_tmp);
-
-        if (do_clipping) {
-            display_width  = __MIN(display_width,  cfg->display.width);
-            display_height = __MIN(display_height, cfg->display.height);
-        }
     }
 
     const unsigned width  = source->i_visible_width;
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index bded014a4f..d7c234b4f1 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1073,7 +1073,7 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
     video_format_t fmt_spu;
     if (do_dr_spu) {
         vout_display_place_t place;
-        vout_display_PlacePicture(&place, &vd->source, vd->cfg, false);
+        vout_display_PlacePicture(&place, &vd->source, vd->cfg);
 
         fmt_spu = vd->source;
         if (fmt_spu.i_width * fmt_spu.i_height < place.width * place.height) {
@@ -1395,7 +1395,7 @@ static void ThreadTranslateMouseState(vout_thread_t *vout,
     vout_display_place_t place;
 
     /* Translate window coordinates to video coordinates */
-    vout_display_PlacePicture(&place, &vd->source, vd->cfg, false);
+    vout_display_PlacePicture(&place, &vd->source, vd->cfg);
 
     if (place.width <= 0 || place.height <= 0)
         return;



More information about the vlc-commits mailing list