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_direct3d.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'video/out/vo_direct3d.c') diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c index ab69fdbdf2..d3c907f944 100644 --- a/video/out/vo_direct3d.c +++ b/video/out/vo_direct3d.c @@ -1558,8 +1558,7 @@ static void check_events(struct vo *vo) static bool get_video_buffer(d3d_priv *priv, struct mp_image *out) { *out = (struct mp_image) {0}; - out->w = out->width = priv->src_width; - out->h = out->height = priv->src_height; + mp_image_set_size(out, priv->src_width, priv->src_height); mp_image_setfmt(out, priv->image_format); if (!priv->d3d_device) @@ -1639,10 +1638,9 @@ static mp_image_t *get_screenshot(d3d_priv *priv) if (!get_video_buffer(priv, &buffer)) return NULL; - struct mp_image *image = alloc_mpi(buffer.w, buffer.h, buffer.imgfmt); - copy_mpi(image, &buffer); - image->display_w = priv->vo->aspdat.prew; - image->display_h = priv->vo->aspdat.preh; + struct mp_image *image = mp_image_new_copy(&buffer); + mp_image_set_display_size(image, priv->vo->aspdat.prew, + priv->vo->aspdat.preh); mp_image_set_colorspace_details(image, &priv->colorspace); -- cgit v1.2.3