d3dx9: Try to use IDirect3DDevice9_StretchRect() in D3DXLoadSurfaceFromSurface().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-11-20 16:36:46 +03:30 committed by Alexandre Julliard
parent 6c7c777f8d
commit 9ff5aae4c8
1 changed files with 32 additions and 0 deletions

View File

@ -1925,6 +1925,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromSurface(IDirect3DSurface9 *dst_surface,
const PALETTEENTRY *src_palette, const RECT *src_rect, DWORD filter, D3DCOLOR color_key) const PALETTEENTRY *src_palette, const RECT *src_rect, DWORD filter, D3DCOLOR color_key)
{ {
IDirect3DSurface9 *surface = src_surface; IDirect3DSurface9 *surface = src_surface;
D3DTEXTUREFILTERTYPE d3d_filter;
IDirect3DDevice9 *device; IDirect3DDevice9 *device;
D3DSURFACE_DESC src_desc; D3DSURFACE_DESC src_desc;
D3DLOCKED_RECT lock; D3DLOCKED_RECT lock;
@ -1939,6 +1940,37 @@ HRESULT WINAPI D3DXLoadSurfaceFromSurface(IDirect3DSurface9 *dst_surface,
if (!dst_surface || !src_surface) if (!dst_surface || !src_surface)
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
if (!dst_palette && !src_palette && !color_key)
{
switch (filter)
{
case D3DX_FILTER_NONE:
d3d_filter = D3DTEXF_NONE;
break;
case D3DX_FILTER_POINT:
d3d_filter = D3DTEXF_POINT;
break;
case D3DX_FILTER_LINEAR:
d3d_filter = D3DTEXF_LINEAR;
break;
default:
d3d_filter = ~0u;
break;
}
if (d3d_filter != ~0u)
{
IDirect3DSurface9_GetDevice(src_surface, &device);
hr = IDirect3DDevice9_StretchRect(device, src_surface, src_rect, dst_surface, dst_rect, d3d_filter);
IDirect3DDevice9_Release(device);
if (SUCCEEDED(hr))
return D3D_OK;
}
}
IDirect3DSurface9_GetDesc(src_surface, &src_desc); IDirect3DSurface9_GetDesc(src_surface, &src_desc);
if (!src_rect) if (!src_rect)