[vlc-commits] vout:win32: always check if the video placement has changed

Steve Lhomme git at videolan.org
Mon Apr 1 16:50:23 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Mar 25 16:46:44 2019 +0100| [d9b060258bbc2475fc4c04bf1aab04b5811a0b0a] | committer: Steve Lhomme

vout:win32: always check if the video placement has changed

it's not CPU intensive and we are sure we don't miss anything.

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

 modules/video_output/win32/common.c     | 27 ++++++++-------------------
 modules/video_output/win32/common.h     |  5 +----
 modules/video_output/win32/direct3d11.c |  6 +++---
 modules/video_output/win32/direct3d9.c  |  4 ++--
 modules/video_output/win32/wingdi.c     |  2 +-
 5 files changed, 15 insertions(+), 29 deletions(-)

diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index 676ccb49f4..3b9368671b 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -84,8 +84,6 @@ int CommonInit(vout_display_t *vd, vout_display_sys_win32_t *sys, bool b_windowl
     sys->b_windowless = b_windowless;
     sys->is_first_placement = true;
     sys->is_on_top        = false;
-    sys->display_width = 0;
-    sys->display_height = 0;
 
     sys->pf_GetDisplayDimensions = GetExternalDimensions;
     sys->opaque_dimensions = vd;
@@ -147,7 +145,7 @@ int CommonInit(vout_display_t *vd, vout_display_sys_win32_t *sys, bool b_windowl
 * its job is to update the source and destination RECTs used to display the
 * picture.
 *****************************************************************************/
-void UpdateRects(vout_display_t *vd, vout_display_sys_win32_t *sys, bool is_forced)
+void UpdateRects(vout_display_t *vd, vout_display_sys_win32_t *sys)
 {
     const video_format_t *source = &vd->source;
 
@@ -163,14 +161,6 @@ void UpdateRects(vout_display_t *vd, vout_display_sys_win32_t *sys, bool is_forc
         return;
     }
 
-    /* If nothing changed, we can return */
-    bool resized = display_width  != sys->display_width ||
-                   display_height != sys->display_height;
-    sys->display_width = display_width;
-    sys->display_height = display_height;
-    if (!is_forced && !resized)
-        return;
-
     /* Update the window position and size */
     vout_display_cfg_t place_cfg = *cfg;
     place_cfg.display.width = display_width;
@@ -271,12 +261,12 @@ void CommonManage(vout_display_t *vd, vout_display_sys_win32_t *sys)
                          RECTHeight(rect_parent),
                          SWP_NOZORDER);
 
-            UpdateRects(vd, sys, false);
+            UpdateRects(vd, sys);
         }
     }
 
     if (EventThreadGetAndResetSizeChanged(sys->event))
-        UpdateRects(vd, sys, false);
+        UpdateRects(vd, sys);
 }
 
 /* */
@@ -418,7 +408,7 @@ static int CommonControlSetFullscreen(vlc_object_t *obj, vout_display_sys_win32_
 void CommonManage(vout_display_t *vd, vout_display_sys_win32_t *sys)
 {
     /* just check the rendering size didn't change */
-    UpdateRects(vd, sys, false);
+    UpdateRects(vd, sys);
 }
 #endif /* VLC_WINSTORE_APP */
 
@@ -429,9 +419,8 @@ int CommonControl(vout_display_t *vd, vout_display_sys_win32_t *sys, int query,
     case VOUT_DISPLAY_CHANGE_ZOOM:           /* const vout_display_cfg_t *p_cfg */
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP: {
-        const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *);
-        sys->vdcfg = *cfg;
-        UpdateRects(vd, sys, true);
+        sys->vdcfg = *va_arg(args, const vout_display_cfg_t *);
+        UpdateRects(vd, sys);
         return VLC_SUCCESS;
     }
     case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:   /* const vout_display_cfg_t *p_cfg */
@@ -451,7 +440,7 @@ int CommonControl(vout_display_t *vd, vout_display_sys_win32_t *sys, int query,
                          RECTHeight(rect_window), SWP_NOMOVE);
         }
 #endif /* !VLC_WINSTORE_APP */
-        UpdateRects(vd, sys, false);
+        UpdateRects(vd, sys);
         return VLC_SUCCESS;
     }
 #if !VLC_WINSTORE_APP
@@ -478,7 +467,7 @@ int CommonControl(vout_display_t *vd, vout_display_sys_win32_t *sys, int query,
         bool fs = va_arg(args, int);
         if (CommonControlSetFullscreen(VLC_OBJECT(vd), sys, fs))
             return VLC_EGENERIC;
-        UpdateRects(vd, sys, false);
+        UpdateRects(vd, sys);
         return VLC_SUCCESS;
     }
 #endif /* !VLC_WINSTORE_APP */
diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index e525161b43..bf8de014cc 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -50,9 +50,6 @@ typedef struct vout_display_sys_win32_t
     HWND                 hparent;             /* Handle of the parent window */
     HWND                 hfswnd;          /* Handle of the fullscreen window */
 
-    /* current size of the display */
-    UINT display_width, display_height;
-
     /* size of the overall window (including black bands) */
     RECT         rect_parent;
 
@@ -88,7 +85,7 @@ void CommonClean(vlc_object_t *, vout_display_sys_win32_t *);
 void CommonManage(vout_display_t *, vout_display_sys_win32_t *);
 int  CommonControl(vout_display_t *, vout_display_sys_win32_t *, int , va_list );
 
-void UpdateRects (vout_display_t *, vout_display_sys_win32_t *, bool is_forced);
+void UpdateRects (vout_display_t *, vout_display_sys_win32_t *);
 
 /*****************************************************************************
  * Constants
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index d710cce8b7..eb65a0ec4b 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -841,7 +841,7 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
                 sys->picQuad.i_height = texDesc.Height;
                 sys->picQuad.i_width = texDesc.Width;
 
-                UpdateRects(vd, &sys->sys, true);
+                UpdateRects(vd, &sys->sys);
                 UpdateSize(vd);
             }
         }
@@ -1457,7 +1457,7 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
         sys->picQuad.i_height = (sys->picQuad.i_height + 0x01) & ~0x01;
     }
 
-    UpdateRects(vd, &sys->sys, true);
+    UpdateRects(vd, &sys->sys);
 
     video_format_t surface_fmt = *fmt;
     surface_fmt.i_width  = sys->picQuad.i_width;
@@ -1567,7 +1567,7 @@ static int Direct3D11CreateGenericResources(vout_display_t *vd)
         ID3D11DepthStencilState_Release(pDepthStencilState);
     }
 
-    UpdateRects(vd, &sys->sys, true);
+    UpdateRects(vd, &sys->sys);
 
     hr = UpdateBackBuffer(vd);
     if (FAILED(hr)) {
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 3d6c287ce2..1e44b74f83 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -899,7 +899,7 @@ static int Direct3D9Reset(vout_display_t *vd, video_format_t *fmtp)
         return VLC_EGENERIC;
     }
 
-    UpdateRects(vd, &sys->sys, true);
+    UpdateRects(vd, &sys->sys);
 
     /* re-create them */
     if (Direct3D9CreateResources(vd, fmtp)) {
@@ -1504,7 +1504,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt,
     fmt->i_bmask  = d3dfmt->bmask;
     sys->sw_texture_fmt = d3dfmt;
 
-    UpdateRects(vd, &sys->sys, true);
+    UpdateRects(vd, &sys->sys);
 
     if (Direct3D9CreateResources(vd, fmt)) {
         msg_Err(vd, "Failed to allocate resources");
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index 5c8e6de7ed..2f5c10e828 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -262,7 +262,7 @@ static int Init(vout_display_t *vd, video_format_t *fmt)
     if (!sys->sys.b_windowless)
         EventThreadUpdateTitle(sys->sys.event, VOUT_TITLE " (WinGDI output)");
 
-    UpdateRects(vd, &sys->sys, true);
+    UpdateRects(vd, &sys->sys);
 
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list