diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-11-23 18:24:53 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-11-23 18:24:53 +0000 |
commit | 161092eb35730a37c2c867814b105b5b5f1079de (patch) | |
tree | b0e0001f0f794d9b04a2340751ca4d1106b46fed | |
parent | e148ffb3ec6014f015e424086cbabb012e42ed96 (diff) | |
download | mpv-161092eb35730a37c2c867814b105b5b5f1079de.tar.bz2 mpv-161092eb35730a37c2c867814b105b5b5f1079de.tar.xz |
Move locked_rect from stack to priv struct in preparation for following patch.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28002 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libvo/vo_direct3d.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c index b3597dba94..d0b1ae4211 100644 --- a/libvo/vo_direct3d.c +++ b/libvo/vo_direct3d.c @@ -52,6 +52,7 @@ const LIBVO_EXTERN(direct3d) static struct global_priv { int is_paused; /**< 1 = Movie is paused, 0 = Movie is not paused */ + D3DLOCKED_RECT locked_rect; /**< The locked Offscreen surface */ RECT fs_movie_rect; /**< Rect (upscaled) of the movie when displayed in fullscreen */ RECT fs_panscan_rect; /**< PanScan source surface cropping in @@ -282,9 +283,6 @@ static void uninit_d3d(void) */ static uint32_t render_d3d_frame(mp_image_t *mpi) { - D3DLOCKED_RECT locked_rect; /**< Offscreen surface we lock in order - to copy MPlayer's frame inside it.*/ - /* Uncomment when direct rendering is implemented. * if (mpi->flags & MP_IMGFLAG_DIRECT) ... */ @@ -299,13 +297,13 @@ static uint32_t render_d3d_frame(mp_image_t *mpi) /* If the previous if failed, we should draw a packed frame */ if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface, - &locked_rect, NULL, 0))) { + &priv->locked_rect, NULL, 0))) { mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>Surface lock failure\n"); return VO_ERROR; } - memcpy_pic(locked_rect.pBits, mpi->planes[0], mpi->stride[0], - mpi->height, locked_rect.Pitch, mpi->stride[0]); + memcpy_pic(priv->locked_rect.pBits, mpi->planes[0], mpi->stride[0], + mpi->height, priv->locked_rect.Pitch, mpi->stride[0]); if (FAILED(IDirect3DSurface9_UnlockRect(priv->d3d_surface))) { mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>Surface unlock failure\n"); @@ -594,31 +592,29 @@ static void check_events(void) */ static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y ) { - D3DLOCKED_RECT locked_rect; /**< Offscreen surface we lock in order - to copy MPlayer's frame inside it.*/ char *Src; /**< Pointer to the source image */ char *Dst; /**< Pointer to the destination image */ int UVstride; /**< Stride of the U/V planes */ if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface, - &locked_rect, NULL, 0))) { + &priv->locked_rect, NULL, 0))) { mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>Surface lock failure\n"); return VO_FALSE; } - UVstride = locked_rect.Pitch / 2; + UVstride = priv->locked_rect.Pitch / 2; /* Copy Y */ - Dst = locked_rect.pBits; - Dst = Dst + locked_rect.Pitch * y + x; + Dst = priv->locked_rect.pBits; + Dst = Dst + priv->locked_rect.Pitch * y + x; Src=src[0]; - memcpy_pic(Dst, Src, w, h, locked_rect.Pitch, stride[0]); + memcpy_pic(Dst, Src, w, h, priv->locked_rect.Pitch, stride[0]); w/=2;h/=2;x/=2;y/=2; /* Copy U */ - Dst = locked_rect.pBits; - Dst = Dst + locked_rect.Pitch * priv->src_height + Dst = priv->locked_rect.pBits; + Dst = Dst + priv->locked_rect.Pitch * priv->src_height + UVstride * y + x; if (priv->movie_src_fmt == MAKEFOURCC('Y','V','1','2')) Src=src[2]; @@ -628,8 +624,8 @@ static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y ) memcpy_pic(Dst, Src, w, h, UVstride, stride[1]); /* Copy V */ - Dst = locked_rect.pBits; - Dst = Dst + locked_rect.Pitch * priv->src_height + Dst = priv->locked_rect.pBits; + Dst = Dst + priv->locked_rect.Pitch * priv->src_height + UVstride * (priv->src_height / 2) + UVstride * y + x; if (priv->movie_src_fmt == MAKEFOURCC('Y','V','1','2')) Src=src[1]; |