From 3376f775e335560fe49c53167a1b402b81fda677 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Tue, 27 Sep 2022 21:26:41 +0200 Subject: [PATCH] vo_gpu_next: fix screenshots of rotated sources I actually don't quite understand why this is needed, since in theory we should already be doing the rotation as part of applying the crop. But I guess that code doesn't quite work. This is the only way it works, so it's probably correct. (And note that `vo_gpu` does the same internally) --- video/out/vo_gpu_next.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index 10a16a5f4f..e48ba4032f 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -1124,11 +1124,14 @@ static void video_screenshot(struct vo *vo, struct voctrl_screenshot *args) struct mp_rect src = p->src, dst = p->dst; struct mp_osd_res osd = p->osd_res; if (!args->scaled) { - src = dst = (struct mp_rect) {0, 0, mpi->params.w, mpi->params.h}; + int w = mpi->params.w, h = mpi->params.h; + if (mpi->params.rotate % 180 == 90) + MPSWAP(int, w, h); + src = dst = (struct mp_rect) {0, 0, w, h}; osd = (struct mp_osd_res) { - .w = mpi->params.w, - .h = mpi->params.h, .display_par = 1.0, + .w = w, + .h = h, }; }