diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2023-09-07 20:50:43 +0200 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-09-09 00:49:19 +0000 |
commit | d467c0e63c93370f5052056eaec782392ee7ff39 (patch) | |
tree | 930a1cba11f805fd1fdb6e24d90ebcdcd334a838 /video | |
parent | 57a6a161720277651b695529bcda236d6535d597 (diff) | |
download | mpv-d467c0e63c93370f5052056eaec782392ee7ff39.tar.bz2 mpv-d467c0e63c93370f5052056eaec782392ee7ff39.tar.xz |
vo_gpu_next: support crop in video_screenshot
Diffstat (limited to 'video')
-rw-r--r-- | video/out/vo_gpu_next.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index 3f9034b2b2..02fd0e595a 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -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), }; } |