d3dx9: Implement ID3DXRenderToSurface::GetDevice.

This commit is contained in:
Józef Kucia 2012-06-05 12:05:45 +02:00 committed by Alexandre Julliard
parent 0ed3eb0120
commit de1f2ffd52
2 changed files with 36 additions and 2 deletions

View File

@ -85,8 +85,15 @@ static ULONG WINAPI D3DXRenderToSurface_Release(ID3DXRenderToSurface *iface)
static HRESULT WINAPI D3DXRenderToSurface_GetDevice(ID3DXRenderToSurface *iface,
IDirect3DDevice9 **device)
{
FIXME("(%p)->(%p): stub\n", iface, device);
return E_NOTIMPL;
struct render_to_surface *render = impl_from_ID3DXRenderToSurface(iface);
TRACE("(%p)->(%p)\n", iface, device);
if (!device) return D3DERR_INVALIDCALL;
IDirect3DDevice9_AddRef(render->device);
*device = render->device;
return D3D_OK;
}
static HRESULT WINAPI D3DXRenderToSurface_GetDesc(ID3DXRenderToSurface *iface,

View File

@ -500,6 +500,32 @@ void test_D3DXCreateRenderToSurface(IDirect3DDevice9 *device)
if (SUCCEEDED(hr)) ID3DXRenderToSurface_Release(render);
}
static void test_ID3DXRenderToSurface(IDirect3DDevice9 *device)
{
HRESULT hr;
ULONG ref_count;
IDirect3DDevice9 *out_device;
ID3DXRenderToSurface *render;
hr = D3DXCreateRenderToSurface(device, 256, 256, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN, &render);
if (FAILED(hr))
{
skip("Failed to create ID3DXRenderToSurface\n");
return;
}
/* GetDevice */
hr = ID3DXRenderToSurface_GetDevice(render, NULL /* device */);
ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::GetDevice returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
ref_count = get_ref((IUnknown *)device);
hr = ID3DXRenderToSurface_GetDevice(render, &out_device);
ok(hr == D3D_OK, "ID3DXRenderToSurface::GetDevice returned %#x, expected %#x\n", hr, D3D_OK);
check_release((IUnknown *)out_device, ref_count);
check_release((IUnknown *)render, 0);
}
START_TEST(core)
{
HWND wnd;
@ -535,6 +561,7 @@ START_TEST(core)
test_ID3DXSprite(device);
test_ID3DXFont(device);
test_D3DXCreateRenderToSurface(device);
test_ID3DXRenderToSurface(device);
check_release((IUnknown*)device, 0);
check_release((IUnknown*)d3d, 0);