From efefe3a6dcfb969ab9f5800b7aecb3ba685ffdbe Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Tue, 8 Aug 2023 21:18:41 -0500 Subject: [PATCH] vo_gpu_next: actually fix screenshots with PAR 983e8f0100b98bd8aed48e5fe86dd5682174b04e resulted in the correct dimensions, but it was not actually right because vo_gpu_next still had the src and dst rects the same. This just needs to work like how vo_gpu does where the src is the image params and the dst is desired output. So basically, just copy that code over here. Fixes #12108 and as a bonus, overriding the aspect ratio now results in correct screenshots (previously didn't work at now and then with the above commit it had correct dimensions but still incorrect output). --- video/out/vo_gpu_next.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index 7b9c477309..52831406b5 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -1212,9 +1212,17 @@ static void video_screenshot(struct vo *vo, struct voctrl_screenshot *args) if (!args->scaled) { int w, h; mp_image_params_get_dsize(&mpi->params, &w, &h); - if (mpi->params.rotate % 180 == 90) + if (w < 1 || h < 1) + return; + + int src_w = mpi->params.w; + int src_h = mpi->params.h; + if (mpi->params.rotate % 180 == 90) { MPSWAP(int, w, h); - src = dst = (struct mp_rect) {0, 0, w, h}; + MPSWAP(int, src_w, src_h); + } + src = (struct mp_rect) {0, 0, src_w, src_h}; + dst = (struct mp_rect) {0, 0, w, h}; osd = (struct mp_osd_res) { .display_par = 1.0, .w = w,