[vlc-devel] [PATCH 25/41] vout:win32: rename rect_src_clipped to source_visible_rect

Steve Lhomme robux4 at ycbcr.xyz
Fri Mar 22 16:14:03 CET 2019


Since it's exactly the source visible area as a rectangle.
---
 modules/video_output/win32/common.c     | 18 +++++++++---------
 modules/video_output/win32/common.h     |  2 +-
 modules/video_output/win32/direct3d11.c | 15 ++++++++-------
 modules/video_output/win32/direct3d9.c  |  5 +++--
 modules/video_output/win32/wingdi.c     | 16 ++++++++--------
 5 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index 726e2b51d8..56a6e9886b 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -147,9 +147,6 @@ int CommonInit(vout_display_t *vd, vout_display_sys_win32_t *sys, bool b_windowl
 static void UpdateRectsInternal(vout_display_t *vd, vout_display_sys_win32_t *sys, bool is_forced)
 {
     const video_format_t *source = &vd->source;
-#define rect_src sys->area.rect_src
-#define rect_src_clipped sys->area.rect_src_clipped
-#define rect_dest sys->area.rect_dest
 
     RECT  new_display_rect;
     POINT window_pos = { 0 };
@@ -223,6 +220,9 @@ static void UpdateRectsInternal(vout_display_t *vd, vout_display_sys_win32_t *sy
     }
 #endif
 
+#define source_visible_rect sys->area.source_visible_rect
+#define rect_src            sys->area.rect_src
+#define rect_dest           sys->area.rect_dest
     /* Destination image position and dimensions */
 #if (defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11)) && !VLC_WINSTORE_APP
     rect_dest.left = 0;
@@ -238,7 +238,7 @@ static void UpdateRectsInternal(vout_display_t *vd, vout_display_sys_win32_t *sy
 
     /* the 2 following lines are to fix a bug when clicking on the desktop */
     if (place.width == 0 || place.height == 0) {
-        SetRectEmpty(&rect_src_clipped);
+        SetRectEmpty(&source_visible_rect);
         goto exit;
     }
 
@@ -249,10 +249,10 @@ static void UpdateRectsInternal(vout_display_t *vd, vout_display_sys_win32_t *sy
     rect_src.bottom = sys->area.pf_GetPictureHeight(vd);
 
     /* Clip the source image */
-    rect_src_clipped.left   = source->i_x_offset;
-    rect_src_clipped.right  = source->i_x_offset + source->i_visible_width;
-    rect_src_clipped.top    = source->i_y_offset;
-    rect_src_clipped.bottom = source->i_y_offset + source->i_visible_height;
+    source_visible_rect.left   = source->i_x_offset;
+    source_visible_rect.right  = source->i_x_offset + source->i_visible_width;
+    source_visible_rect.top    = source->i_y_offset;
+    source_visible_rect.bottom = source->i_y_offset + source->i_visible_height;
 
 #ifndef NDEBUG
     msg_Dbg(vd, "DirectXUpdateRects source"
@@ -278,7 +278,7 @@ exit:
     sys->area.changes |= DX_POSITION_CHANGE;
 
 #undef rect_src
-#undef rect_src_clipped
+#undef source_visible_rect
 #undef rect_dest
 }
 
diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index 84c0a87ac7..a9ea22b411 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -36,7 +36,7 @@ typedef struct display_win32_area_t
 
     /* Coordinates of src and dest images (used when blitting to display) */
     RECT         rect_src;
-    RECT         rect_src_clipped;
+    RECT         source_visible_rect;
     RECT         rect_dest;
 
     vout_display_cfg_t vdcfg;
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 84d66131ec..3a5245347f 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -212,7 +212,7 @@ static void UpdateSize(vout_display_t *vd)
 
     UpdatePicQuadPosition(vd);
 
-    D3D11_UpdateQuadPosition(vd, &sys->d3d_dev, &sys->picQuad, &sys->sys.area.rect_src_clipped,
+    D3D11_UpdateQuadPosition(vd, &sys->d3d_dev, &sys->picQuad, &sys->sys.area.source_visible_rect,
                              vd->source.orientation);
 
     d3d11_device_unlock( &sys->d3d_dev );
@@ -221,12 +221,12 @@ static void UpdateSize(vout_display_t *vd)
 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_visible_src  = sys->sys.area.source_visible_rect;
     RECT before_dest         = sys->sys.area.rect_dest;
 
     CommonManage(vd, &sys->sys);
 
-    if (!RectEquals(&before_src_clipped, &sys->sys.area.rect_src_clipped) ||
+    if (!RectEquals(&before_visible_src, &sys->sys.area.source_visible_rect) ||
         !RectEquals(&before_dest, &sys->sys.area.rect_dest))
     {
         UpdateSize(vd);
@@ -751,7 +751,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;
-    RECT before_src_clipped  = sys->sys.area.rect_src_clipped;
+    RECT before_visible_src  = sys->sys.area.source_visible_rect;
     RECT before_dest         = sys->sys.area.rect_dest;
 
     int res = CommonControl( vd, &sys->sys, query, args );
@@ -766,7 +766,7 @@ static int Control(vout_display_t *vd, int query, va_list args)
         }
     }
 
-    if (!RectEquals(&before_src_clipped,  &sys->sys.area.rect_src_clipped) ||
+    if (!RectEquals(&before_visible_src,  &sys->sys.area.source_visible_rect) ||
         !RectEquals(&before_dest,         &sys->sys.area.rect_dest) )
     {
         UpdateSize(vd);
@@ -1482,8 +1482,9 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
        return VLC_EGENERIC;
     }
 
-    if (D3D11_SetupQuad( vd, &sys->d3d_dev, &surface_fmt, &sys->picQuad, &sys->display, &sys->sys.area.rect_src_clipped,
-                   vd->source.orientation ) != VLC_SUCCESS) {
+    if (D3D11_SetupQuad( vd, &sys->d3d_dev, &surface_fmt, &sys->picQuad, &sys->display,
+                         &sys->sys.area.source_visible_rect,
+                         vd->source.orientation ) != VLC_SUCCESS) {
         msg_Err(vd, "Could not Create the main quad picture.");
         return VLC_EGENERIC;
     }
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 7056de25e7..170f112224 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -448,7 +448,7 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
 
     /* Copy picture surface into texture surface
      * color space conversion happen here */
-    RECT copy_rect = sys->sys.area.rect_src_clipped;
+    RECT copy_rect = sys->sys.area.source_visible_rect;
     // On nVidia & AMD, StretchRect will fail if the visible size isn't even.
     // When copying the entire buffer, the margin end up being blended in the actual picture
     // on nVidia (regardless of even/odd dimensions)
@@ -467,7 +467,8 @@ 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,
+    Direct3D9SetupVertices(region->vertex, &vd->sys->sys.area.rect_src,
+                           &vd->sys->sys.area.source_visible_rect,
                            &vd->sys->sys.area.rect_dest, 255, vd->source.orientation);
     return VLC_SUCCESS;
 }
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index 523ddc0c88..e2774ee9b1 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -151,30 +151,30 @@ static void Display(vout_display_t *vd, picture_t *picture)
     vout_display_sys_t *sys = vd->sys;
     VLC_UNUSED(picture);
 
-#define rect_src_clipped sys->sys.area.rect_src_clipped
-#define rect_dest sys->sys.area.rect_dest
+#define source_visible_rect sys->sys.area.source_visible_rect
+#define rect_dest           sys->sys.area.rect_dest
     HDC hdc = GetDC(sys->sys.hvideownd);
 
     SelectObject(sys->off_dc, sys->off_bitmap);
 
-    if (RECTWidth(rect_dest) != RECTWidth(rect_src_clipped) ||
-        RECTHeight(rect_dest) != RECTHeight(rect_src_clipped)) {
+    if (RECTWidth(rect_dest) != RECTWidth(source_visible_rect) ||
+        RECTHeight(rect_dest) != RECTHeight(source_visible_rect)) {
         StretchBlt(hdc, 0, 0,
                    RECTWidth(rect_dest), RECTHeight(rect_dest),
                    sys->off_dc,
-                   rect_src_clipped.left,  rect_src_clipped.top,
-                   rect_src_clipped.right, rect_src_clipped.bottom,
+                   source_visible_rect.left,  source_visible_rect.top,
+                   source_visible_rect.right, source_visible_rect.bottom,
                    SRCCOPY);
     } else {
         BitBlt(hdc, 0, 0,
                RECTWidth(rect_dest), RECTHeight(rect_dest),
                sys->off_dc,
-               rect_src_clipped.left, rect_src_clipped.top,
+               source_visible_rect.left, source_visible_rect.top,
                SRCCOPY);
     }
 
     ReleaseDC(sys->sys.hvideownd, hdc);
-#undef rect_src_clipped
+#undef source_visible_rect
 #undef rect_dest
 
     CommonDisplay(&sys->sys);
-- 
2.17.1



More information about the vlc-devel mailing list