Commit e0cf7085 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

direct3d9: avoid a copy in direct rendering

(cherry picked from commit 63905375)
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 919ce4c5
......@@ -503,17 +503,26 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
else if (picture->context)
{
const struct va_pic_context *pic_ctx = (struct va_pic_context*)picture->context;
if (pic_ctx->picsys.surface != picture->p_sys->surface)
if (pic_ctx->picsys.surface != surface)
{
HRESULT hr;
RECT visibleSource;
visibleSource.left = 0;
visibleSource.top = 0;
visibleSource.right = picture->format.i_visible_width;
visibleSource.bottom = picture->format.i_visible_height;
hr = IDirect3DDevice9_StretchRect( p_d3d9_dev->dev, pic_ctx->picsys.surface, &visibleSource, surface, &visibleSource, D3DTEXF_NONE);
if (FAILED(hr)) {
msg_Err(vd, "Failed to copy the hw surface to the decoder surface (hr=0x%0lx)", hr );
D3DSURFACE_DESC srcDesc, dstDesc;
IDirect3DSurface9_GetDesc(pic_ctx->picsys.surface, &srcDesc);
IDirect3DSurface9_GetDesc(surface, &dstDesc);
if ( srcDesc.Width == dstDesc.Width && srcDesc.Height == dstDesc.Height )
surface = pic_ctx->picsys.surface;
else
{
HRESULT hr;
RECT visibleSource;
visibleSource.left = 0;
visibleSource.top = 0;
visibleSource.right = picture->format.i_visible_width;
visibleSource.bottom = picture->format.i_visible_height;
hr = IDirect3DDevice9_StretchRect( p_d3d9_dev->dev, pic_ctx->picsys.surface, &visibleSource, surface, &visibleSource, D3DTEXF_NONE);
if (FAILED(hr)) {
msg_Err(vd, "Failed to copy the hw surface to the decoder surface (hr=0x%0lx)", hr );
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment