d3d9/tests: Use proper helpers for iface calls.

This commit is contained in:
Jacek Caban 2012-08-28 11:10:25 +02:00 committed by Alexandre Julliard
parent 242f9acdf6
commit 9bb70e2739
4 changed files with 21 additions and 21 deletions

View File

@ -107,7 +107,7 @@ static HRESULT reset_device(IDirect3DDevice9 *device, HWND device_window, BOOL w
#define CHECK_RELEASE(obj,d,rc) \
if (obj) { \
int tmp1, rc_new = rc; \
IUnknown_Release( obj ); \
IUnknown_Release( (IUnknown*)obj ); \
tmp1 = get_refcount( (IUnknown *)d ); \
ok(tmp1 == rc_new, "Invalid refcount. Expected %d got %d\n", rc_new, tmp1); \
}
@ -154,7 +154,7 @@ static void check_mipmap_levels(IDirect3DDevice9 *device, UINT width, UINT heigh
} else
trace("CreateTexture failed: %08x\n", hr);
if (texture) IUnknown_Release( texture );
if (texture) IDirect3DBaseTexture9_Release( texture );
}
static void test_mipmap_levels(void)
@ -196,10 +196,10 @@ static void test_mipmap_levels(void)
cleanup:
if (pDevice)
{
UINT refcount = IUnknown_Release( pDevice );
UINT refcount = IDirect3DDevice9_Release( pDevice );
ok(!refcount, "Device has %u references left.\n", refcount);
}
if (pD3d) IUnknown_Release( pD3d );
if (pD3d) IDirect3D9_Release( pD3d );
DestroyWindow( hwnd );
}
@ -255,10 +255,10 @@ static void test_checkdevicemultisampletype(void)
cleanup:
if (pDevice)
{
UINT refcount = IUnknown_Release( pDevice );
UINT refcount = IDirect3DDevice9_Release( pDevice );
ok(!refcount, "Device has %u references left.\n", refcount);
}
if (pD3d) IUnknown_Release( pD3d );
if (pD3d) IDirect3D9_Release( pD3d );
DestroyWindow( hwnd );
}

View File

@ -281,13 +281,13 @@ static int switch_render_target(IDirect3DDevice9 *device, struct event_data *eve
ok (hret == D3D_OK, "SetRenderTarget returned %#x.\n", hret);
if (hret != D3D_OK) goto error;
IUnknown_Release(backbuffer);
IDirect3DSurface9_Release(backbuffer);
event_data->new_swap_chain = swapchain;
return EVENT_OK;
error:
if (backbuffer) IUnknown_Release(backbuffer);
if (swapchain) IUnknown_Release(swapchain);
if (backbuffer) IDirect3DSurface9_Release(backbuffer);
if (swapchain) IDirect3DSwapChain9_Release(swapchain);
return EVENT_ERROR;
}
@ -299,12 +299,12 @@ static int revert_render_target(IDirect3DDevice9 *device, struct event_data *eve
hret = IDirect3DDevice9_SetRenderTarget(device, 0, event_data->original_render_target);
ok (hret == D3D_OK, "SetRenderTarget returned %#x.\n", hret);
if (hret != D3D_OK) {
IUnknown_Release(event_data->original_render_target);
IDirect3DSurface9_Release(event_data->original_render_target);
return EVENT_ERROR;
}
IUnknown_Release(event_data->original_render_target);
IUnknown_Release(event_data->new_swap_chain);
IDirect3DSurface9_Release(event_data->original_render_target);
IDirect3DSwapChain9_Release(event_data->new_swap_chain);
return EVENT_OK;
}
@ -361,7 +361,7 @@ static int end_stateblock(IDirect3DDevice9 *device, struct event_data *event_dat
static int release_stateblock(IDirect3DDevice9 *device, struct event_data *event_data)
{
IUnknown_Release(event_data->stateblock);
IDirect3DStateBlock9_Release(event_data->stateblock);
return EVENT_OK;
}
@ -372,11 +372,11 @@ static int apply_stateblock(IDirect3DDevice9 *device, struct event_data *event_d
hret = IDirect3DStateBlock9_Apply(event_data->stateblock);
ok(hret == D3D_OK, "Apply returned %#x.\n", hret);
if (hret != D3D_OK) {
IUnknown_Release(event_data->stateblock);
IDirect3DStateBlock9_Release(event_data->stateblock);
return EVENT_ERROR;
}
IUnknown_Release(event_data->stateblock);
IDirect3DStateBlock9_Release(event_data->stateblock);
return EVENT_OK;
}

View File

@ -181,7 +181,7 @@ static void test_surface_alignment(IDirect3DDevice9 *device_ptr)
ok(rc.Pitch == pitch, "Wrong pitch for DXT%d lvl[%d (%dx%d)]: expected %d got %d\n",
i + 1, j, descr.Width, descr.Height, pitch, rc.Pitch);
}
IUnknown_Release( pTexture );
IDirect3DTexture9_Release( pTexture );
}
}

View File

@ -267,11 +267,11 @@ static HRESULT test_fvf_to_decl(IDirect3DDevice9 *device, IDirect3DVertexDeclara
else if (compare_elements(result_decl, expected_elements) != S_OK)
goto fail;
if (result_decl) IUnknown_Release( result_decl );
if (result_decl) IDirect3DVertexDeclaration9_Release( result_decl );
return S_OK;
fail:
if (result_decl) IUnknown_Release( result_decl );
if (result_decl) IDirect3DVertexDeclaration9_Release( result_decl );
return E_FAIL;
}
@ -308,12 +308,12 @@ static HRESULT test_decl_to_fvf(IDirect3DDevice9* device, DWORD default_fvf,
if (test_fvf != result_fvf) goto fail;
IDirect3DDevice9_SetVertexDeclaration ( device, NULL );
if (vdecl) IUnknown_Release( vdecl );
if (vdecl) IDirect3DVertexDeclaration9_Release( vdecl );
return S_OK;
fail:
IDirect3DDevice9_SetVertexDeclaration ( device, NULL );
if (vdecl) IUnknown_Release( vdecl );
if (vdecl) IDirect3DVertexDeclaration9_Release( vdecl );
return E_FAIL;
}
@ -644,7 +644,7 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice)
cleanup:
IDirect3DDevice9_SetVertexDeclaration ( pDevice, NULL );
if ( default_decl ) IUnknown_Release (default_decl);
if ( default_decl ) IDirect3DVertexDeclaration9_Release (default_decl);
}
/* Check whether a declaration converted from FVF is shared.