[vlc-devel] [PATCH 17/41] vout:win32: remove rect_dest_clipped

Steve Lhomme robux4 at ycbcr.xyz
Fri Mar 22 16:13:55 CET 2019


It's always the same values as rect_dest
---
 modules/video_output/win32/common.c     | 17 ++++-------------
 modules/video_output/win32/common.h     |  1 -
 modules/video_output/win32/direct3d11.c | 12 ++++--------
 modules/video_output/win32/direct3d9.c  |  9 ++++-----
 modules/video_output/win32/wingdi.c     |  8 +++-----
 5 files changed, 15 insertions(+), 32 deletions(-)

diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index 53ceda9a0f..729b6a7641 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -143,7 +143,6 @@ static void UpdateRectsInternal(vout_display_t *vd, bool is_forced)
 #define rect_src sys->area.rect_src
 #define rect_src_clipped sys->area.rect_src_clipped
 #define rect_dest sys->area.rect_dest
-#define rect_dest_clipped sys->area.rect_dest_clipped
 
     RECT  new_display_rect;
     POINT window_pos = { 0 };
@@ -230,9 +229,6 @@ static void UpdateRectsInternal(vout_display_t *vd, bool is_forced)
     rect_dest.bottom = rect_dest.top + place.height;
 #endif
 
-    /* AFAIK, there are no clipping constraints in Direct3D, OpenGL and GDI */
-    rect_dest_clipped = rect_dest;
-
     /* the 2 following lines are to fix a bug when clicking on the desktop */
     if (place.width == 0 || place.height == 0) {
 #if !VLC_WINSTORE_APP
@@ -249,18 +245,18 @@ static void UpdateRectsInternal(vout_display_t *vd, bool is_forced)
 
     /* Clip the source image */
     rect_src_clipped.left = source->i_x_offset +
-        (rect_dest_clipped.left - rect_dest.left) *
+        (rect_dest.left - rect_dest.left) *
         source->i_visible_width / RECTWidth(rect_dest);
     rect_src_clipped.right = source->i_x_offset +
         source->i_visible_width -
-        (rect_dest.right - rect_dest_clipped.right) *
+        (rect_dest.right - rect_dest.right) *
         source->i_visible_width / RECTWidth(rect_dest);
     rect_src_clipped.top = source->i_y_offset +
-        (rect_dest_clipped.top - rect_dest.top) *
+        (rect_dest.top - rect_dest.top) *
         source->i_visible_height / RECTHeight(rect_dest);
     rect_src_clipped.bottom = source->i_y_offset +
         source->i_visible_height -
-        (rect_dest.bottom - rect_dest_clipped.bottom) *
+        (rect_dest.bottom - rect_dest.bottom) *
         source->i_visible_height / RECTHeight(rect_dest);
 
 #ifndef NDEBUG
@@ -280,10 +276,6 @@ static void UpdateRectsInternal(vout_display_t *vd, bool is_forced)
         " coords: %li,%li,%li,%li",
         rect_dest.left, rect_dest.top,
         rect_dest.right, rect_dest.bottom);
-    msg_Dbg(vd, "DirectXUpdateRects image_dst_clipped"
-        " coords: %li,%li,%li,%li",
-        rect_dest_clipped.left, rect_dest_clipped.top,
-        rect_dest_clipped.right, rect_dest_clipped.bottom);
 #endif
 
     CommonChangeThumbnailClip(vd, true);
@@ -295,7 +287,6 @@ exit:
 #undef rect_src
 #undef rect_src_clipped
 #undef rect_dest
-#undef rect_dest_clipped
 }
 
 void UpdateRects(vout_display_t *vd)
diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index 296f61283c..7d38977748 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -38,7 +38,6 @@ typedef struct display_win32_area_t
     RECT         rect_src;
     RECT         rect_src_clipped;
     RECT         rect_dest;
-    RECT         rect_dest_clipped;
 
     vout_display_cfg_t vdcfg;
 
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index e845cdaf51..1c0321d7ce 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -190,7 +190,7 @@ static HRESULT UpdateBackBuffer(vout_display_t *vd)
 #if VLC_WINSTORE_APP
     if (!GetRect(&sys->sys, &rect))
 #endif
-        rect = sys->sys.area.rect_dest_clipped;
+        rect = sys->sys.area.rect_dest;
     uint32_t i_width = RECTWidth(rect);
     uint32_t i_height = RECTHeight(rect);
 
@@ -203,8 +203,8 @@ static HRESULT UpdateBackBuffer(vout_display_t *vd)
 static void UpdateSize(vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
-    msg_Dbg(vd, "Detected size change %dx%d", RECTWidth(sys->sys.area.rect_dest_clipped),
-            RECTHeight(sys->sys.area.rect_dest_clipped));
+    msg_Dbg(vd, "Detected size change %dx%d", RECTWidth(sys->sys.area.rect_dest),
+            RECTHeight(sys->sys.area.rect_dest));
 
     UpdateBackBuffer(vd);
 
@@ -222,13 +222,11 @@ static void Manage(vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
     RECT before_src_clipped  = sys->sys.area.rect_src_clipped;
-    RECT before_dest_clipped = sys->sys.area.rect_dest_clipped;
     RECT before_dest         = sys->sys.area.rect_dest;
 
     CommonManage(vd);
 
     if (!RectEquals(&before_src_clipped, &sys->sys.area.rect_src_clipped) ||
-        !RectEquals(&before_dest_clipped, &sys->sys.area.rect_dest_clipped) ||
         !RectEquals(&before_dest, &sys->sys.area.rect_dest))
     {
         UpdateSize(vd);
@@ -752,7 +750,6 @@ static int Control(vout_display_t *vd, int query, va_list args)
 {
     vout_display_sys_t *sys = vd->sys;
     RECT before_src_clipped  = sys->sys.area.rect_src_clipped;
-    RECT before_dest_clipped = sys->sys.area.rect_dest_clipped;
     RECT before_dest         = sys->sys.area.rect_dest;
 
     int res = CommonControl( vd, query, args );
@@ -768,7 +765,6 @@ static int Control(vout_display_t *vd, int query, va_list args)
     }
 
     if (!RectEquals(&before_src_clipped,  &sys->sys.area.rect_src_clipped) ||
-        !RectEquals(&before_dest_clipped, &sys->sys.area.rect_dest_clipped) ||
         !RectEquals(&before_dest,         &sys->sys.area.rect_dest) )
     {
         UpdateSize(vd);
@@ -1377,7 +1373,7 @@ static void UpdatePicQuadPosition(vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
 
-    D3D11_UpdateViewport( &sys->picQuad, &sys->sys.area.rect_dest_clipped, sys->display.pixelFormat );
+    D3D11_UpdateViewport( &sys->picQuad, &sys->sys.area.rect_dest, sys->display.pixelFormat );
 
     SetQuadVSProjection(vd, &sys->picQuad, &sys->sys.area.vdcfg.viewpoint);
 
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 5da7cf9e7c..68a2243cda 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -468,7 +468,7 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
     /* */
     region->texture = sys->sceneTexture;
     Direct3D9SetupVertices(region->vertex, &vd->sys->sys.area.rect_src, &vd->sys->sys.area.rect_src_clipped,
-                           &vd->sys->sys.area.rect_dest_clipped, 255, vd->source.orientation);
+                           &vd->sys->sys.area.rect_dest, 255, vd->source.orientation);
     return VLC_SUCCESS;
 }
 
@@ -1315,14 +1315,13 @@ static void Swap(void *opaque)
 
     // Present the back buffer contents to the display
     // No stretching should happen here !
-    const RECT src = sys->sys.area.rect_dest_clipped;
-    const RECT dst = sys->sys.area.rect_dest_clipped;
+    const RECT src = sys->sys.area.rect_dest;
 
     HRESULT hr;
     if (sys->hd3d.use_ex) {
-        hr = IDirect3DDevice9Ex_PresentEx(p_d3d9_dev->devex, &src, &dst, NULL, NULL, 0);
+        hr = IDirect3DDevice9Ex_PresentEx(p_d3d9_dev->devex, &src, &src, NULL, NULL, 0);
     } else {
-        hr = IDirect3DDevice9_Present(p_d3d9_dev->dev, &src, &dst, NULL, NULL);
+        hr = IDirect3DDevice9_Present(p_d3d9_dev->dev, &src, &src, NULL, NULL);
     }
     if (FAILED(hr)) {
         msg_Dbg(vd, "Failed Present: 0x%0lx", hr);
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index 348d42b722..a994a6bef9 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -147,15 +147,14 @@ static void Display(vout_display_t *vd, picture_t *picture)
 
 #define rect_src_clipped sys->sys.area.rect_src_clipped
 #define rect_dest sys->sys.area.rect_dest
-#define rect_dest_clipped sys->sys.area.rect_dest_clipped
-    RECT dst_rect = rect_dest_clipped;
+    RECT dst_rect = rect_dest;
     HDC hdc = GetDC(sys->sys.hvideownd);
 
     OffsetRect(&dst_rect, -rect_dest.left, -rect_dest.top);
     SelectObject(sys->off_dc, sys->off_bitmap);
 
-    if (RECTWidth(rect_dest_clipped) != RECTWidth(rect_src_clipped) ||
-        RECTHeight(rect_dest_clipped) != RECTHeight(rect_src_clipped)) {
+    if (RECTWidth(rect_dest) != RECTWidth(rect_src_clipped) ||
+        RECTHeight(rect_dest) != RECTHeight(rect_src_clipped)) {
         StretchBlt(hdc, dst_rect.left, dst_rect.top,
                    dst_rect.right, dst_rect.bottom,
                    sys->off_dc,
@@ -173,7 +172,6 @@ static void Display(vout_display_t *vd, picture_t *picture)
     ReleaseDC(sys->sys.hvideownd, hdc);
 #undef rect_src_clipped
 #undef rect_dest
-#undef rect_dest_clipped
 
     CommonDisplay(vd);
     CommonManage(vd);
-- 
2.17.1



More information about the vlc-devel mailing list