diff options
Diffstat (limited to 'video/out/vo_direct3d.c')
-rw-r--r-- | video/out/vo_direct3d.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c index e265b0b38f..f16ac87703 100644 --- a/video/out/vo_direct3d.c +++ b/video/out/vo_direct3d.c @@ -130,6 +130,8 @@ typedef struct d3d_priv { struct vo *vo; + bool have_image; + D3DLOCKED_RECT locked_rect; /**< The locked offscreen surface */ RECT fs_movie_rect; /**< Rect (upscaled) of the movie when displayed in fullscreen */ @@ -842,6 +844,9 @@ static uint32_t d3d_draw_frame(d3d_priv *priv) IDirect3DDevice9_Clear(priv->d3d_device, 0, NULL, D3DCLEAR_TARGET, 0, 0, 0); + if (!priv->have_image) + return VO_TRUE; + if (priv->use_textures) { for (n = 0; n < priv->plane_count; n++) { @@ -1271,6 +1276,8 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, { d3d_priv *priv = vo->priv; + priv->have_image = false; + /* w32_common framework call. Creates window on the screen with * the given coordinates. */ @@ -1412,6 +1419,8 @@ static void draw_image(struct vo *vo, mp_image_t *mpi) } } + priv->have_image = true; + d3d_draw_frame(priv); } @@ -1420,6 +1429,9 @@ static mp_image_t *get_screenshot(d3d_priv *priv) if (!priv->d3d_device) return NULL; + if (!priv->have_image) + return NULL; + struct mp_image buffer; if (!get_video_buffer(priv, &buffer)) return NULL; |