diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2023-09-07 21:05:02 +0200 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-09-09 00:49:19 +0000 |
commit | b8177f7b5237050ca61c3161078b2954ecd58b03 (patch) | |
tree | 840eae90cbde7e5787350cc55c068103a1a99d98 /video/out/gpu/video.c | |
parent | d467c0e63c93370f5052056eaec782392ee7ff39 (diff) | |
download | mpv-b8177f7b5237050ca61c3161078b2954ecd58b03.tar.bz2 mpv-b8177f7b5237050ca61c3161078b2954ecd58b03.tar.xz |
vo_gpu: support crop in gl_video_screenshot
Diffstat (limited to 'video/out/gpu/video.c')
-rw-r--r-- | video/out/gpu/video.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index 97778c1f46..e9f658426f 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -3470,14 +3470,24 @@ void gl_video_screenshot(struct gl_video *p, struct vo_frame *frame, int src_w = p->image_params.w; int src_h = p->image_params.h; + struct mp_rect src = {0, 0, src_w, src_h}; + struct mp_rect dst = {0, 0, w, h}; + + if (mp_image_crop_valid(&p->image_params)) + src = p->image_params.crop; + if (p->image_params.rotate % 180 == 90) { MPSWAP(int, w, h); MPSWAP(int, src_w, src_h); } + mp_rect_rotate(&src, src_w, src_h, p->image_params.rotate); + mp_rect_rotate(&dst, w, h, p->image_params.rotate); - struct mp_rect src = {0, 0, src_w, src_h}; - struct mp_rect dst = {0, 0, w, h}; - struct mp_osd_res osd = {.w = w, .h = h, .display_par = 1.0}; + struct mp_osd_res osd = { + .display_par = 1.0, + .w = mp_rect_w(dst), + .h = mp_rect_h(dst), + }; gl_video_resize(p, &src, &dst, &osd); } |