[vlc-commits] direct3d11: support scaling subpictures in the GPU

Steve Lhomme git at videolan.org
Mon Nov 26 08:56:37 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Nov 22 14:33:51 2018 +0100| [9a19a36f07f0dea1b436ad7dfcd26806c908c5e6] | committer: Steve Lhomme

direct3d11: support scaling subpictures in the GPU

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

 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 );



More information about the vlc-commits mailing list