1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-25 04:38:01 +00:00

vo_gpu_next: support crop in video_screenshot

This commit is contained in:
Kacper Michajłow 2023-09-07 20:50:43 +02:00 committed by Dudemanguy
parent 57a6a16172
commit d467c0e63c

View File

@ -1289,16 +1289,23 @@ static void video_screenshot(struct vo *vo, struct voctrl_screenshot *args)
int src_w = mpi->params.w;
int src_h = mpi->params.h;
src = (struct mp_rect) {0, 0, src_w, src_h};
dst = (struct mp_rect) {0, 0, w, h};
if (mp_image_crop_valid(&mpi->params))
src = mpi->params.crop;
if (mpi->params.rotate % 180 == 90) {
MPSWAP(int, 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};
mp_rect_rotate(&src, src_w, src_h, mpi->params.rotate);
mp_rect_rotate(&dst, w, h, mpi->params.rotate);
osd = (struct mp_osd_res) {
.display_par = 1.0,
.w = w,
.h = h,
.w = mp_rect_w(dst),
.h = mp_rect_h(dst),
};
}