[vlc-devel] [PATCH v3 19/20] vout: win32: simplify setting the placement as changed

Steve Lhomme robux4 at ycbcr.xyz
Wed Aug 26 13:55:46 CEST 2020


---
 modules/video_output/win32/common.c     | 16 ++++------------
 modules/video_output/win32/common.h     |  7 +++++--
 modules/video_output/win32/direct3d11.c |  6 +++---
 modules/video_output/win32/direct3d9.c  |  4 ++--
 modules/video_output/win32/glwin32.c    |  2 +-
 modules/video_output/win32/wingdi.c     |  2 +-
 6 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index b76a2f44e1b..a2b957b1241 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -80,7 +80,7 @@ int CommonWindowInit(vout_display_t *vd, display_win32_area_t *area,
     sys->hparent       = hwnd.hparent;
     sys->hvideownd     = hwnd.hvideownd;
 
-    CommonPlacePicture(vd, area);
+    SetPlacementChanged(area);
 
     return VLC_SUCCESS;
 }
@@ -93,14 +93,6 @@ int CommonWindowInit(vout_display_t *vd, display_win32_area_t *area,
 * its job is to update the source and destination RECTs used to display the
 * picture.
 *****************************************************************************/
-void CommonPlacePicture(vout_display_t *vd, display_win32_area_t *area)
-{
-    /* Update the window position and size */
-    {
-        area->place_changed |= true;
-    }
-}
-
 #if !VLC_WINSTORE_APP
 /* */
 void CommonWindowClean(vout_display_sys_win32_t *sys)
@@ -112,14 +104,14 @@ void CommonWindowClean(vout_display_sys_win32_t *sys)
 }
 #endif /* !VLC_WINSTORE_APP */
 
-int CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys, int query)
+int CommonControl(display_win32_area_t *area, vout_display_sys_win32_t *sys, int query)
 {
     switch (query) {
     case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
     case VOUT_DISPLAY_CHANGE_ZOOM:
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP: {
-        CommonPlacePicture(vd, area);
+        SetPlacementChanged(area);
         return VLC_SUCCESS;
     }
     case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
@@ -135,7 +127,7 @@ int CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_s
                          RECTHeight(clientRect), SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
         }
 #endif /* !VLC_WINSTORE_APP */
-        CommonPlacePicture(vd, area);
+        SetPlacementChanged(area);
         return VLC_SUCCESS;
     }
 
diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index c741bdecf83..c90affb5732 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -67,9 +67,12 @@ int  CommonWindowInit(vout_display_t *, display_win32_area_t *, vout_display_sys
                       bool projection_gestures);
 void CommonWindowClean(vout_display_sys_win32_t *);
 #endif /* !VLC_WINSTORE_APP */
-int  CommonControl(vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *, int );
+int  CommonControl(display_win32_area_t *, vout_display_sys_win32_t *, int );
 
-void CommonPlacePicture (vout_display_t *, display_win32_area_t *);
+static inline void SetPlacementChanged(display_win32_area_t *area)
+{
+    area->place_changed = true;
+}
 
 void CommonInit(display_win32_area_t *);
 
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 3eae603ded8..e518c47de38 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -490,7 +490,7 @@ static void SetQuadVSProjection(vout_display_t *vd, d3d_quad_t *quad, const vlc_
 static int Control(vout_display_t *vd, int query, va_list args)
 {
     vout_display_sys_t *sys = vd->sys;
-    int res = CommonControl( vd, &sys->area, &sys->sys, query );
+    int res = CommonControl( &sys->area, &sys->sys, query );
 
     if (query == VOUT_DISPLAY_CHANGE_VIEWPOINT)
     {
@@ -615,8 +615,8 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
                 sys->picQuad.i_height = texDesc.Height;
                 sys->picQuad.i_width = texDesc.Width;
 
-                CommonPlacePicture(vd, &sys->area);
                 UpdateSize(vd);
+                sys->area.place_changed = false;
             }
         }
     }
@@ -812,7 +812,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp, vlc_video_co
         sys->picQuad.i_height = (sys->picQuad.i_height + 0x01) & ~0x01;
     }
 
-    CommonPlacePicture(vd, &sys->area);
+    SetPlacementChanged(&sys->area);
 
     err = QueryDisplayFormat(vd, &fmt);
     if (err != VLC_SUCCESS) {
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 7ee3c24fe04..d3cf979eb93 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -1704,7 +1704,7 @@ static int Control(vout_display_t *vd, int query, va_list args)
         return VLC_SUCCESS;
     }
     default:
-        return CommonControl(vd, &sys->area, &sys->sys, query);
+        return CommonControl(&sys->area, &sys->sys, query);
     }
 }
 
@@ -1850,7 +1850,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     }
 
     if (sys->swapCb == LocalSwapchainSwap)
-        CommonPlacePicture(vd, &sys->area);
+        SetPlacementChanged(&sys->area);
 
     sys->hxdll = Direct3D9LoadShaderLibrary();
     if (!sys->hxdll)
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index 9002db5af50..a880c01270b 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -81,7 +81,7 @@ static int Control(vout_display_t *vd, int query, va_list args)
         return vout_display_opengl_SetViewpoint(sys->vgl,
                                                 va_arg(args, const vlc_viewpoint_t*));
 
-    return CommonControl(vd, &sys->area, &sys->sys, query);
+    return CommonControl(&sys->area, &sys->sys, query);
 }
 
 static const struct vout_window_operations embedVideoWindow_Ops =
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index 38cefe0de59..ae4cb61ddc1 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -101,7 +101,7 @@ static int Control(vout_display_t *vd, int query, va_list args)
 {
     VLC_UNUSED(args);
     vout_display_sys_t *sys = vd->sys;
-    return CommonControl(vd, &sys->area, &sys->sys, query);
+    return CommonControl(&sys->area, &sys->sys, query);
 }
 
 /* */
-- 
2.26.2



More information about the vlc-devel mailing list