d3d10core: COM cleanup for the ID3D10Texture2D iface.

This commit is contained in:
Michael Stefaniuc 2011-06-01 10:12:44 +02:00 committed by Alexandre Julliard
parent b5a103d2d1
commit 7d295ddfa4
3 changed files with 16 additions and 11 deletions

View File

@ -84,7 +84,7 @@ void d3d10_device_init(struct d3d10_device *device, void *outer_unknown) DECLSPE
/* ID3D10Texture2D */
struct d3d10_texture2d
{
const struct ID3D10Texture2DVtbl *vtbl;
ID3D10Texture2D ID3D10Texture2D_iface;
LONG refcount;
IUnknown *dxgi_surface;

View File

@ -681,7 +681,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *ifac
return hr;
}
*texture = (ID3D10Texture2D *)object;
*texture = &object->ID3D10Texture2D_iface;
TRACE("Created ID3D10Texture2D %p\n", object);
@ -1380,7 +1380,7 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
*surface = texture->wined3d_surface;
wined3d_surface_incref(*surface);
ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
return S_OK;
}
@ -1423,7 +1423,7 @@ static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_par
*surface = texture->wined3d_surface;
wined3d_surface_incref(*surface);
ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
return S_OK;
}
@ -1464,7 +1464,7 @@ static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_pa
*surface = texture->wined3d_surface;
wined3d_surface_incref(*surface);
ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
return S_OK;
}

View File

@ -24,11 +24,16 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
static inline struct d3d10_texture2d *impl_from_ID3D10Texture2D(ID3D10Texture2D *iface)
{
return CONTAINING_RECORD(iface, struct d3d10_texture2d, ID3D10Texture2D_iface);
}
/* IUnknown methods */
static HRESULT STDMETHODCALLTYPE d3d10_texture2d_QueryInterface(ID3D10Texture2D *iface, REFIID riid, void **object)
{
struct d3d10_texture2d *This = (struct d3d10_texture2d *)iface;
struct d3d10_texture2d *This = impl_from_ID3D10Texture2D(iface);
TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
@ -56,7 +61,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture2d_QueryInterface(ID3D10Texture2D
static ULONG STDMETHODCALLTYPE d3d10_texture2d_AddRef(ID3D10Texture2D *iface)
{
struct d3d10_texture2d *This = (struct d3d10_texture2d *)iface;
struct d3d10_texture2d *This = impl_from_ID3D10Texture2D(iface);
ULONG refcount = InterlockedIncrement(&This->refcount);
TRACE("%p increasing refcount to %u\n", This, refcount);
@ -77,7 +82,7 @@ static void STDMETHODCALLTYPE d3d10_texture2d_wined3d_object_released(void *pare
static ULONG STDMETHODCALLTYPE d3d10_texture2d_Release(ID3D10Texture2D *iface)
{
struct d3d10_texture2d *This = (struct d3d10_texture2d *)iface;
struct d3d10_texture2d *This = impl_from_ID3D10Texture2D(iface);
ULONG refcount = InterlockedDecrement(&This->refcount);
TRACE("%p decreasing refcount to %u\n", This, refcount);
@ -166,7 +171,7 @@ static void STDMETHODCALLTYPE d3d10_texture2d_Unmap(ID3D10Texture2D *iface, UINT
static void STDMETHODCALLTYPE d3d10_texture2d_GetDesc(ID3D10Texture2D *iface, D3D10_TEXTURE2D_DESC *desc)
{
struct d3d10_texture2d *This = (struct d3d10_texture2d *)iface;
struct d3d10_texture2d *This = impl_from_ID3D10Texture2D(iface);
TRACE("iface %p, desc %p\n", iface, desc);
@ -204,7 +209,7 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
{
HRESULT hr;
texture->vtbl = &d3d10_texture2d_vtbl;
texture->ID3D10Texture2D_iface.lpVtbl = &d3d10_texture2d_vtbl;
texture->refcount = 1;
texture->desc = *desc;
@ -220,7 +225,7 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
}
hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL,
(IUnknown *)texture, (void **)&texture->dxgi_surface);
(IUnknown *)&texture->ID3D10Texture2D_iface, (void **)&texture->dxgi_surface);
IWineDXGIDevice_Release(wine_device);
if (FAILED(hr))
{