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. --- sub/draw_bmp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'sub') diff --git a/sub/draw_bmp.c b/sub/draw_bmp.c index 594fcabdfd..ac347f7374 100644 --- a/sub/draw_bmp.c +++ b/sub/draw_bmp.c @@ -333,11 +333,7 @@ static void mp_image_crop(struct mp_image *img, struct mp_rect rc) (rc.y0 >> (p ? img->chroma_y_shift : 0)) * img->stride[p] + (rc.x0 >> (p ? img->chroma_x_shift : 0)) * bits / 8; } - img->w = rc.x1 - rc.x0; - img->h = rc.y1 - rc.y0; - img->chroma_width = img->w >> img->chroma_x_shift; - img->chroma_height = img->h >> img->chroma_y_shift; - img->display_w = img->display_h = 0; + mp_image_set_size(img, rc.x1 - rc.x0, rc.y1 - rc.y0); } static bool clip_to_bb(struct mp_rect bb, struct mp_rect *rc) -- cgit v1.2.3