[vlc-commits] direct3d11: use D3D11_UpdateViewport()

Steve Lhomme git at videolan.org
Mon May 28 13:25:42 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jan  9 17:59:45 2018 +0100| [dc2f0619a79abbee9a4e1d86185d26ff4b28167a] | committer: Steve Lhomme

direct3d11: use D3D11_UpdateViewport()

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

 modules/video_output/win32/direct3d11.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 1f5f8bc9a8..2df89b58ea 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1391,13 +1391,7 @@ static void UpdatePicQuadPosition(vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
 
-    sys->picQuad.cropViewport.Width    = RECTWidth(sys->sys.rect_dest_clipped);
-    sys->picQuad.cropViewport.Height   = RECTHeight(sys->sys.rect_dest_clipped);
-    sys->picQuad.cropViewport.TopLeftX = sys->sys.rect_dest_clipped.left;
-    sys->picQuad.cropViewport.TopLeftY = sys->sys.rect_dest_clipped.top;
-
-    sys->picQuad.cropViewport.MinDepth = 0.0f;
-    sys->picQuad.cropViewport.MaxDepth = 1.0f;
+    D3D11_UpdateViewport( &sys->picQuad, &sys->sys.rect_dest_clipped );
 
     SetQuadVSProjection(vd, &sys->picQuad, &vd->cfg->viewpoint);
 
@@ -1852,12 +1846,13 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
 
         d3d_quad_t *quad = (d3d_quad_t *) quad_picture->p_sys;
 
-        quad->cropViewport.Width =  (FLOAT) r->fmt.i_visible_width  * RECTWidth(sys->sys.rect_dest)  / subpicture->i_original_picture_width;
-        quad->cropViewport.Height = (FLOAT) r->fmt.i_visible_height * RECTHeight(sys->sys.rect_dest) / subpicture->i_original_picture_height;
-        quad->cropViewport.MinDepth = 0.0f;
-        quad->cropViewport.MaxDepth = 1.0f;
-        quad->cropViewport.TopLeftX = sys->sys.rect_dest.left + (FLOAT) r->i_x * RECTWidth(sys->sys.rect_dest) / subpicture->i_original_picture_width;
-        quad->cropViewport.TopLeftY = sys->sys.rect_dest.top  + (FLOAT) r->i_y * RECTHeight(sys->sys.rect_dest) / subpicture->i_original_picture_height;
+        RECT spuViewport;
+        spuViewport.left   = sys->sys.rect_dest.left + (FLOAT) r->i_x * RECTWidth(sys->sys.rect_dest)  / subpicture->i_original_picture_width;
+        spuViewport.top    = sys->sys.rect_dest.top  + (FLOAT) r->i_y * RECTHeight(sys->sys.rect_dest) / subpicture->i_original_picture_height;
+        spuViewport.right  = sys->sys.rect_dest.left + (FLOAT) (r->i_x + r->fmt.i_visible_width)  * RECTWidth(sys->sys.rect_dest)  / subpicture->i_original_picture_width;
+        spuViewport.bottom = sys->sys.rect_dest.top  + (FLOAT) (r->i_y + r->fmt.i_visible_height) * RECTHeight(sys->sys.rect_dest) / subpicture->i_original_picture_height;
+
+        D3D11_UpdateViewport( quad, &spuViewport );
 
         D3D11_UpdateQuadOpacity(vd, &sys->d3d_dev, quad, r->i_alpha / 255.0f );
     }



More information about the vlc-commits mailing list