[vlc-devel] [PATCH 3/3] direct3d11: support scaling subpictures in the GPU

Steve Lhomme robux4 at ycbcr.xyz
Fri Nov 23 09:42:14 CET 2018


---
 modules/video_output/win32/direct3d11.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 801cbf284e..69f20bc52f 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -388,6 +388,7 @@ static int Open(vlc_object_t *object)
 
     vd->info.has_double_click     = true;
     vd->info.has_pictures_invalid = vd->info.is_slow;
+    vd->info.can_scale_spu        = true;
 
     if (var_InheritBool(vd, "direct3d11-hw-blending") &&
         sys->regionQuad.textureFormat != NULL)
@@ -1782,6 +1783,17 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
         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;
 
+        if (r->zoom_h.num != 0 && r->zoom_h.den != 0)
+        {
+            spuViewport.left   = (FLOAT) spuViewport.left   * r->zoom_h.num / r->zoom_h.den;
+            spuViewport.right  = (FLOAT) spuViewport.right  * r->zoom_h.num / r->zoom_h.den;
+        }
+        if (r->zoom_v.num != 0 && r->zoom_v.den != 0)
+        {
+            spuViewport.top    = (FLOAT) spuViewport.top    * r->zoom_v.num / r->zoom_v.den;
+            spuViewport.bottom = (FLOAT) spuViewport.bottom * r->zoom_v.num / r->zoom_v.den;
+        }
+
         D3D11_UpdateViewport( quad, &spuViewport, sys->display.pixelFormat );
 
         D3D11_UpdateQuadOpacity(vd, &sys->d3d_dev, quad, r->i_alpha / 255.0f );
-- 
2.17.1



More information about the vlc-devel mailing list