[vlc-commits] direct3d11: fix cropping on vertical videos
Steve Lhomme
git at videolan.org
Sat Feb 17 10:13:01 CET 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Feb 16 15:55:35 2018 +0100| [291dcad8cb55b8c99f54b6a602d923adcc2c82c6] | committer: Steve Lhomme
direct3d11: fix cropping on vertical videos
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=291dcad8cb55b8c99f54b6a602d923adcc2c82c6
---
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 e76161972f..c7fe0f4b68 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -2332,16 +2332,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