[vlc-devel] [PATCH v2 02/19] vout: win32: add a flag tell if the alignment is relative to the bottom-left

Steve Lhomme robux4 at ycbcr.xyz
Tue Aug 25 16:20:15 CEST 2020


By default it should be aligned to the top-left.
---
 modules/video_output/Makefile.am        |  3 ---
 modules/video_output/win32/common.c     | 17 +++--------------
 modules/video_output/win32/common.h     |  3 ++-
 modules/video_output/win32/direct3d11.c |  2 +-
 modules/video_output/win32/direct3d9.c  |  2 +-
 modules/video_output/win32/glwin32.c    |  2 +-
 modules/video_output/win32/wingdi.c     |  2 +-
 7 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
index 87cd6c8ae64..3a265658f61 100644
--- a/modules/video_output/Makefile.am
+++ b/modules/video_output/Makefile.am
@@ -143,9 +143,6 @@ libglwin32_plugin_la_SOURCES = \
 	video_output/win32/win32touch.c video_output/win32/win32touch.h
 libwgl_plugin_la_SOURCES = video_output/win32/wgl.c
 
-libglwin32_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
-	-DMODULE_NAME_IS_glwin32
-
 libglwin32_plugin_la_LIBADD = libchroma_copy.la -lopengl32 -lgdi32 $(LIBCOM) -luuid libvlc_opengl.la
 libwgl_plugin_la_LIBADD = -lopengl32 -lgdi32 libvlc_opengl.la
 
diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index 5e65da9071a..11ff257a3ee 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -41,10 +41,11 @@
 #include "common.h"
 #include "../../video_chroma/copy.h"
 
-void CommonInit(display_win32_area_t *area, const vout_display_cfg_t *vdcfg)
+void CommonInit(display_win32_area_t *area, enum vout_place_origin origin, const vout_display_cfg_t *vdcfg)
 {
     area->place_changed = false;
     area->vdcfg = *vdcfg;
+    area->origin = origin;
 }
 
 #if !VLC_WINSTORE_APP
@@ -98,21 +99,9 @@ void CommonPlacePicture(vout_display_t *vd, display_win32_area_t *area, vout_dis
 {
     /* Update the window position and size */
     vout_display_cfg_t place_cfg = area->vdcfg;
-    enum vout_place_origin origin;
-
-#if (defined(MODULE_NAME_IS_glwin32))
-    origin = VOUT_ORIGIN_BOTTOM_LEFT;
-    /* Reverse vertical alignment as the GL tex are Y inverted */
-    if (place_cfg.align.vertical == VLC_VIDEO_ALIGN_TOP)
-        place_cfg.align.vertical = VLC_VIDEO_ALIGN_BOTTOM;
-    else if (place_cfg.align.vertical == VLC_VIDEO_ALIGN_BOTTOM)
-        place_cfg.align.vertical = VLC_VIDEO_ALIGN_TOP;
-#else
-    origin = VOUT_ORIGIN_TOP_LEFT;
-#endif
 
     vout_display_place_t before_place = area->place;
-    vout_display_PlacePicture(&area->place, &vd->source, &place_cfg, origin);
+    vout_display_PlacePicture(&area->place, &vd->source, &place_cfg, area->origin);
 
     /* Signal the change in size/position */
     if (!vout_display_PlaceEquals(&before_place, &area->place))
diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index 8eb48f72435..562be27bf23 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -35,6 +35,7 @@ typedef struct display_win32_area_t
     /* Coordinates of dest images (used when blitting to display) */
     vout_display_place_t  place;
     bool                  place_changed;
+    enum vout_place_origin origin;
 
     vout_display_cfg_t    vdcfg;
 } display_win32_area_t;
@@ -75,7 +76,7 @@ int  CommonControl(vout_display_t *, display_win32_area_t *, vout_display_sys_wi
 
 void CommonPlacePicture (vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *);
 
-void CommonInit(display_win32_area_t *, const vout_display_cfg_t *);
+void CommonInit(display_win32_area_t *, enum vout_place_origin origin, const vout_display_cfg_t *);
 
 # ifdef __cplusplus
 extern "C" {
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 5affcf3068f..375ef67500b 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -296,7 +296,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if (ret != VLC_SUCCESS)
         goto error;
 
-    CommonInit(&sys->area, cfg);
+    CommonInit(&sys->area, VOUT_ORIGIN_TOP_LEFT, cfg);
 
     sys->outside_opaque = var_InheritAddress( vd, "vout-cb-opaque" );
     sys->updateOutputCb      = var_InheritAddress( vd, "vout-cb-update-output" );
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 175ea4da755..439d94cf9fc 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -1802,7 +1802,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if (!sys)
         return VLC_ENOMEM;
 
-    CommonInit(&sys->area, cfg);
+    CommonInit(&sys->area, VOUT_ORIGIN_TOP_LEFT, cfg);
 
     sys->outside_opaque = var_InheritAddress( vd, "vout-cb-opaque" );
     sys->updateOutputCb      = var_InheritAddress( vd, "vout-cb-update-output" );
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index 7397d7e9bbe..6b7d0a3f0a7 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -120,7 +120,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         return VLC_ENOMEM;
 
     /* */
-    CommonInit(&sys->area, cfg);
+    CommonInit(&sys->area, VOUT_ORIGIN_BOTTOM_LEFT, cfg);
     if (CommonWindowInit(vd, &sys->area, &sys->sys,
                    vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR))
         goto error;
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index 3d09d84fa2a..8d55a6f0f3c 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -116,7 +116,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if (!sys)
         return VLC_ENOMEM;
 
-    CommonInit(&sys->area, cfg);
+    CommonInit(&sys->area, VOUT_ORIGIN_TOP_LEFT, cfg);
     if (CommonWindowInit(vd, &sys->area, &sys->sys, false))
         goto error;
 
-- 
2.26.2



More information about the vlc-devel mailing list