summaryrefslogtreecommitdiffstats
path: root/video/out/vo_direct3d.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-10 02:02:24 +0100
committerwm4 <wm4@nowhere>2013-01-13 17:39:32 +0100
commitd77d9fb933e0e7dc34de02f3d0c13791ddd80114 (patch)
treeca45e0f9d753e7ee7b5bd142eb2aed1638bf391c /video/out/vo_direct3d.c
parent1568161aadf24ee3a6d982612b7380f8b1dc4a58 (diff)
downloadmpv-d77d9fb933e0e7dc34de02f3d0c13791ddd80114.tar.bz2
mpv-d77d9fb933e0e7dc34de02f3d0c13791ddd80114.tar.xz
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.
Diffstat (limited to 'video/out/vo_direct3d.c')
-rw-r--r--video/out/vo_direct3d.c10
1 files changed, 4 insertions, 6 deletions
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);