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

Steve Lhomme robux4 at ycbcr.xyz
Tue Aug 25 09:30:08 CEST 2020


---
 modules/video_output/win32/common.c     | 20 +++-----------------
 modules/video_output/win32/common.h     |  5 ++++-
 modules/video_output/win32/direct3d11.c |  4 ++--
 modules/video_output/win32/direct3d9.c  |  2 +-
 4 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index c8165cc7a95..ab4e0c8be17 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -80,26 +80,12 @@ 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;
 }
 #endif /* !VLC_WINSTORE_APP */
 
-/*****************************************************************************
-* UpdateRects: update clipping rectangles
-*****************************************************************************
-* This function is called when the window position or size are changed, and
-* 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)
-{
-    {
-        area->place_changed |= true;
-    }
-}
-
 #if !VLC_WINSTORE_APP
 /* */
 void CommonWindowClean(vout_display_sys_win32_t *sys)
@@ -118,7 +104,7 @@ int CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_s
     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:
@@ -134,7 +120,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..f86e189d004 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -69,7 +69,10 @@ 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 );
 
-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 d8048f6c58a..1c48ed12e4d 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -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 8b5d26a1b88..bf449102a29 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -1850,7 +1850,7 @@ static int Open(vout_display_t *vd, vout_display_cfg_t *cfg,
     }
 
     if (sys->swapCb == LocalSwapchainSwap)
-        CommonPlacePicture(vd, &sys->area);
+        SetPlacementChanged(&sys->area);
 
     sys->hxdll = Direct3D9LoadShaderLibrary();
     if (!sys->hxdll)
-- 
2.26.2



More information about the vlc-devel mailing list