[vlc-commits] direct3d11: fix cropping on vertical videos

Steve Lhomme git at videolan.org
Mon Mar 19 11:33:25 CET 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Feb 16 15:55:35 2018 +0100| [2c0ba0981ee0d7a02899a0bf54a031109a3292ab] | committer: Jean-Baptiste Kempf

direct3d11: fix cropping on vertical videos

(cherry picked from commit 291dcad8cb55b8c99f54b6a602d923adcc2c82c6)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/video_output/win32/direct3d11.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 6126e2ec36..f61bfc9d56 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -2339,16 +2339,18 @@ static void SetupQuadFlat(d3d_vertex_t *dst_data, const RECT *output,
     float MidX,MidY;
 
     float top, bottom, left, right;
+    /* find the middle of the visible part of the texture, it will be a 0,0
+     * the rest of the visible area must correspond to -1,1 */
     switch (orientation)
     {
     case ORIENT_ROTATED_90: /* 90° anti clockwise */
         /* right/top aligned */
         MidY = (output->left + output->right) / 2.f;
         MidX = (output->top + output->bottom) / 2.f;
-        top    =  (src_width  - MidX) / (output->right - MidX);
-        bottom = -MidY / (MidY - output->top);
-        left   = -(src_height - MidY) / (output->bottom - MidY);
-        right  =   MidX / (MidX - output->left);
+        top    =  MidY / (MidY - output->top);
+        bottom = -(src_height - MidX) / (MidX - output->top);
+        left   =  (MidX - src_height) / (MidX - output->left);
+        right  =                 MidX / (MidX - (src_width - output->right));
         break;
     case ORIENT_ROTATED_180: /* 180° */
         /* right/top aligned */



More information about the vlc-commits mailing list