From c62efc52c6c5f9dc9cf8e335f6e934e69a721331 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 26 Oct 2012 20:19:06 +0200 Subject: screenshot: remove hack for passing anamorphic image size With anamorphic video (display with non-1:1 PAR, e.g. DVD), the display size was passed using the mp_image fields w/h, which was blatantly incorrect. w/h are the normal image dimensions, while width/height are the "uncropped" storage size (used internally by vf.c). Add a display_w/h, and use that for the display size. Make all VOs that can do screenshots use it. --- screenshot.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'screenshot.c') diff --git a/screenshot.c b/screenshot.c index f69bba9b76..87de5c2d37 100644 --- a/screenshot.c +++ b/screenshot.c @@ -242,25 +242,23 @@ static struct mp_image *add_subs(struct MPContext *mpctx, image->imgfmt); copy_mpi(new_image, image); vf_clone_mpi_attributes(new_image, image); - new_image->w = image->w; - new_image->h = image->h; image = new_image; } + int d_w = image->display_w ? image->display_w : image->w; + int d_h = image->display_h ? image->display_h : image->h; + double sar = (double)image->width / image->height; - double dar = (double)image->w / image->h; + double dar = (double)d_w / d_h; struct mp_osd_res res = { - .w = image->width, - .h = image->height, + .w = image->w, + .h = image->h, .display_par = sar / dar, .video_par = dar / sar, }; - // It's not really clear what's the difference between w and width - struct mp_image hack = *image; - hack.w = hack.width; - hack.h = hack.height; + osd_draw_on_image(mpctx->osd, res, mpctx->osd->vo_pts, - OSD_DRAW_SUB_ONLY, &hack); + OSD_DRAW_SUB_ONLY, image); return image; } -- cgit v1.2.3