[vlc-commits] direct3d9: render the texture at 0,0 in the viewport

Steve Lhomme git at videolan.org
Mon Apr 1 16:50:03 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Mar 25 12:30:52 2019 +0100| [7edcc8245f02aab204084c3fd48c0b6eca35bf1d] | committer: Steve Lhomme

direct3d9: render the texture at 0,0 in the viewport

We don't need to do a special case in common code.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7edcc8245f02aab204084c3fd48c0b6eca35bf1d
---

 modules/video_output/win32/common.c    |  2 +-
 modules/video_output/win32/direct3d9.c | 15 +++++++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index db0b7f2319..349f7c668c 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -211,7 +211,7 @@ void UpdateRects(vout_display_t *vd, vout_display_sys_win32_t *sys, bool is_forc
 #define rect_dest           sys->rect_dest
     RECT before_rect_dest = rect_dest;
     /* Destination image position and dimensions */
-#if (defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11)) && !VLC_WINSTORE_APP
+#if defined(MODULE_NAME_IS_direct3d11) && !VLC_WINSTORE_APP
     rect_dest.left = 0;
     rect_dest.right = place.width;
     rect_dest.top = 0;
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index b936226cf6..90c06797b5 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -483,8 +483,14 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
         .top    = 0,
         .bottom = vd->source.i_height,
     };
+    RECT rect_dst = {
+        .left   = 0,
+        .right  = RECTWidth(sys->sys.rect_dest),
+        .top    = 0,
+        .bottom = RECTHeight(sys->sys.rect_dest),
+    };
     Direct3D9SetupVertices(region->vertex, &rect_src, &copy_rect,
-                           &vd->sys->sys.rect_dest, 255, vd->source.orientation);
+                           &rect_dst, 255, vd->source.orientation);
     return VLC_SUCCESS;
 }
 
@@ -1060,9 +1066,9 @@ static void Direct3D9ImportSubpicture(vout_display_t *vd,
         const float scale_h = (float)(RECTHeight(video))  / subpicture->i_original_picture_height;
 
         RECT dst;
-        dst.left   = video.left + scale_w * r->i_x,
+        dst.left   =            scale_w * r->i_x,
         dst.right  = dst.left + scale_w * r->fmt.i_visible_width,
-        dst.top    = video.top  + scale_h * r->i_y,
+        dst.top    =            scale_h * r->i_y,
         dst.bottom = dst.top  + scale_h * r->fmt.i_visible_height;
 
         RECT src;
@@ -1331,7 +1337,8 @@ static void Swap(void *opaque)
 
     // Present the back buffer contents to the display
     // No stretching should happen here !
-    const RECT src = sys->sys.rect_dest;
+    RECT src = sys->sys.rect_dest;
+    OffsetRect(&src, -src.left, -src.top);
     
     HRESULT hr;
     if (sys->hd3d.use_ex) {



More information about the vlc-commits mailing list