[vlc-commits] direct3d11: render the texture at 0,0 in the viewport
Steve Lhomme
git at videolan.org
Mon Apr 1 16:50:04 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Mar 25 12:40:48 2019 +0100| [a1cae053e67cf4a33879b42bd0701e6bae254fa1] | committer: Steve Lhomme
direct3d11: 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=a1cae053e67cf4a33879b42bd0701e6bae254fa1
---
modules/video_output/win32/common.c | 7 -------
modules/video_output/win32/direct3d11.c | 13 ++++++++-----
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index 349f7c668c..8777deabb8 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -211,17 +211,10 @@ 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_direct3d11) && !VLC_WINSTORE_APP
- rect_dest.left = 0;
- rect_dest.right = place.width;
- rect_dest.top = 0;
- rect_dest.bottom = place.height;
-#else
rect_dest.left = point.x + place.x;
rect_dest.right = rect_dest.left + place.width;
rect_dest.top = point.y + place.y;
rect_dest.bottom = rect_dest.top + place.height;
-#endif
/* Signal the change in size/position */
if (!EqualRect(&before_rect_dest, &rect_dest))
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index b4b4c925e8..8575524790 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1362,7 +1362,10 @@ static void UpdatePicQuadPosition(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
- D3D11_UpdateViewport( &sys->picQuad, &sys->sys.rect_dest, sys->display.pixelFormat );
+ RECT rect_dst = sys->sys.rect_dest;
+ OffsetRect(&rect_dst, -rect_dst.left, -rect_dst.top);
+
+ D3D11_UpdateViewport( &sys->picQuad, &rect_dst, sys->display.pixelFormat );
SetQuadVSProjection(vd, &sys->picQuad, &sys->sys.vdcfg.viewpoint);
@@ -1804,10 +1807,10 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
d3d_quad_t *quad = (d3d_quad_t *) quad_picture->p_sys;
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;
+ spuViewport.left = (FLOAT) r->i_x * RECTWidth(sys->sys.rect_dest) / subpicture->i_original_picture_width;
+ spuViewport.top = (FLOAT) r->i_y * RECTHeight(sys->sys.rect_dest) / subpicture->i_original_picture_height;
+ spuViewport.right = (FLOAT) (r->i_x + r->fmt.i_visible_width) * RECTWidth(sys->sys.rect_dest) / subpicture->i_original_picture_width;
+ spuViewport.bottom = (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)
{
More information about the vlc-commits
mailing list