From d77d9fb933e0e7dc34de02f3d0c13791ddd80114 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 10 Nov 2012 02:02:24 +0100 Subject: mp_image: require using mp_image_set_size() for setting w/h Setting the size of a mp_image must be done with mp_image_set_size() now. Do this to guarantee that the redundant fields (like chroma_width) are updated consistently. Replacing the redundant fields by function calls would probably be better, but there are too many uses of them, and is a bit less convenient. Most code actually called mp_image_setfmt(), which did this as well. This commit just makes things a bit more explicit. Warning: the video filter chain still sets up mp_images manually, and vf_get_image() is not updated. --- video/out/vo_xv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'video/out/vo_xv.c') diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c index cc4d55777d..46fe4649f5 100644 --- a/video/out/vo_xv.c +++ b/video/out/vo_xv.c @@ -318,8 +318,7 @@ static struct mp_image get_xv_buffer(struct vo *vo, int buf_index) XvImage *xv_image = ctx->xvimage[buf_index]; struct mp_image img = {0}; - img.w = img.width = ctx->image_width; - img.h = img.height = ctx->image_height; + mp_image_set_size(&img, ctx->image_width, ctx->image_height); mp_image_setfmt(&img, ctx->image_format); bool swapuv = ctx->image_format == IMGFMT_YV12; @@ -398,10 +397,9 @@ static mp_image_t *get_screenshot(struct vo *vo) struct mp_image *res = alloc_mpi(img.w, img.h, img.imgfmt); copy_mpi(res, &img); vf_clone_mpi_attributes(res, &img); + mp_image_set_display_size(res, vo->aspdat.prew, vo->aspdat.preh); // try to get an image without OSD mp_draw_sub_backup_restore(ctx->osd_backup, res); - res->display_w = vo->aspdat.prew; - res->display_h = vo->aspdat.preh; return res; } -- cgit v1.2.3