[vlc-commits] direct3d11: use the full window size for the rendering area

Steve Lhomme git at videolan.org
Tue Apr 30 11:13:44 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Apr 17 08:22:16 2019 +0200| [f9ae0e5703282523bca5c9101ec9e07cb3deff61] | committer: Steve Lhomme

direct3d11: use the full window size for the rendering area

We cannot rely on the output always having the exact aspect ratio of the video.
So we draw on the whole window area and place the video accordingly.

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

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

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 0ad8942f3d..848593eb52 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -183,8 +183,8 @@ static HRESULT UpdateBackBuffer(vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
     UINT i_width, i_height;
-    i_width  = sys->area.place.width;
-    i_height = sys->area.place.height;
+    i_width  = sys->area.vdcfg.display.width;
+    i_height = sys->area.vdcfg.display.height;
 
     if (!sys->resizeCb(sys->outside_opaque, i_width, i_height))
         return E_FAIL;
@@ -476,7 +476,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if (d3d11_ctx == NULL)
     {
         if (CommonInit(VLC_OBJECT(vd), &sys->area, &sys->sys,
-                       vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR, false))
+                       vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR, true))
             goto error;
     }
 #else /* !VLC_WINSTORE_APP */
@@ -1357,10 +1357,10 @@ static void UpdatePicQuadPosition(vout_display_t *vd)
     vout_display_sys_t *sys = vd->sys;
 
     RECT rect_dst = {
-        .left   = 0,
-        .right  = sys->area.place.width,
-        .top    = 0,
-        .bottom = sys->area.place.height
+        .left   = sys->area.place.x,
+        .right  = sys->area.place.x + sys->area.place.width,
+        .top    = sys->area.place.y,
+        .bottom = sys->area.place.y + sys->area.place.height
     };
 
     D3D11_UpdateViewport( &sys->picQuad, &rect_dst, sys->display.pixelFormat );
@@ -1821,6 +1821,12 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
             spuViewport.bottom = (FLOAT) spuViewport.bottom * r->zoom_v.num / r->zoom_v.den;
         }
 
+        /* move the SPU inside the video area */
+        spuViewport.left   += sys->area.place.x;
+        spuViewport.right  += sys->area.place.x;
+        spuViewport.top    += sys->area.place.y;
+        spuViewport.bottom += sys->area.place.y;
+
         D3D11_UpdateViewport( quad, &spuViewport, sys->display.pixelFormat );
 
         D3D11_UpdateQuadOpacity(vd, &sys->d3d_dev, quad, r->i_alpha / 255.0f );



More information about the vlc-commits mailing list