mirror of https://github.com/mpv-player/mpv
Move the StretchRect call from draw_slices to render_d3d_frame.
This avoids calling it (and BeginScene/EndScene) many times with slices and also avoids code duplication. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28001 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
2e5c6e2f4e
commit
e148ffb3ec
|
@ -290,19 +290,14 @@ static uint32_t render_d3d_frame(mp_image_t *mpi)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
|
if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
|
||||||
return VO_TRUE;
|
goto skip_upload;
|
||||||
|
|
||||||
if (mpi->flags & MP_IMGFLAG_PLANAR) { /* Copy a planar frame. */
|
if (mpi->flags & MP_IMGFLAG_PLANAR) { /* Copy a planar frame. */
|
||||||
draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,0,0);
|
draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,0,0);
|
||||||
return VO_TRUE;
|
goto skip_upload;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the previous if failed, we should draw a packed frame */
|
/* If the previous if failed, we should draw a packed frame */
|
||||||
if (FAILED(IDirect3DDevice9_BeginScene(priv->d3d_device))) {
|
|
||||||
mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>BeginScene failed\n");
|
|
||||||
return VO_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface,
|
if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface,
|
||||||
&locked_rect, NULL, 0))) {
|
&locked_rect, NULL, 0))) {
|
||||||
mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>Surface lock failure\n");
|
mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>Surface lock failure\n");
|
||||||
|
@ -317,6 +312,12 @@ static uint32_t render_d3d_frame(mp_image_t *mpi)
|
||||||
return VO_ERROR;
|
return VO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skip_upload:
|
||||||
|
if (FAILED(IDirect3DDevice9_BeginScene(priv->d3d_device))) {
|
||||||
|
mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>BeginScene failed\n");
|
||||||
|
return VO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (FAILED(IDirect3DDevice9_StretchRect(priv->d3d_device,
|
if (FAILED(IDirect3DDevice9_StretchRect(priv->d3d_device,
|
||||||
priv->d3d_surface,
|
priv->d3d_surface,
|
||||||
&priv->fs_panscan_rect,
|
&priv->fs_panscan_rect,
|
||||||
|
@ -599,11 +600,6 @@ static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y )
|
||||||
char *Dst; /**< Pointer to the destination image */
|
char *Dst; /**< Pointer to the destination image */
|
||||||
int UVstride; /**< Stride of the U/V planes */
|
int UVstride; /**< Stride of the U/V planes */
|
||||||
|
|
||||||
if (FAILED(IDirect3DDevice9_BeginScene(priv->d3d_device))) {
|
|
||||||
mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>BeginScene failed\n");
|
|
||||||
return VO_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface,
|
if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface,
|
||||||
&locked_rect, NULL, 0))) {
|
&locked_rect, NULL, 0))) {
|
||||||
mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>Surface lock failure\n");
|
mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>Surface lock failure\n");
|
||||||
|
@ -647,22 +643,6 @@ static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y )
|
||||||
return VO_ERROR;
|
return VO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(IDirect3DDevice9_StretchRect(priv->d3d_device,
|
|
||||||
priv->d3d_surface,
|
|
||||||
&priv->fs_panscan_rect,
|
|
||||||
priv->d3d_backbuf,
|
|
||||||
&priv->fs_movie_rect,
|
|
||||||
D3DTEXF_LINEAR))) {
|
|
||||||
mp_msg(MSGT_VO,MSGL_V,
|
|
||||||
"<vo_direct3d>Unable to copy the frame to the back buffer\n");
|
|
||||||
return VO_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FAILED(IDirect3DDevice9_EndScene(priv->d3d_device))) {
|
|
||||||
mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>EndScene failed\n");
|
|
||||||
return VO_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0; /* Success */
|
return 0; /* Success */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue