[vlc-devel] [PATCH 27/41] direct3d9: use the source visible area directly

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


Instead of using source_visible_rect.

Incidentally we setup the vertices to match exactly the size that was copied
rather than the actual size which may use uninitialized pixels.
---
 modules/video_output/win32/direct3d9.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 170f112224..f20ec56c29 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -448,7 +448,12 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
 
     /* Copy picture surface into texture surface
      * color space conversion happen here */
-    RECT copy_rect = sys->sys.area.source_visible_rect;
+    RECT copy_rect = {
+        .left   = vd->source.i_x_offset,
+        .right  = vd->source.i_x_offset + vd->source.i_visible_width,
+        .top    = vd->source.i_y_offset,
+        .bottom = vd->source.i_y_offset + vd->source.i_visible_height,
+    };
     // 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)
@@ -468,7 +473,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.source_visible_rect,
+                           &copy_rect,
                            &vd->sys->sys.area.rect_dest, 255, vd->source.orientation);
     return VLC_SUCCESS;
 }
-- 
2.17.1



More information about the vlc-devel mailing list