Commit 7d295ddf authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

d3d10core: COM cleanup for the ID3D10Texture2D iface.

parent b5a103d2
...@@ -84,7 +84,7 @@ void d3d10_device_init(struct d3d10_device *device, void *outer_unknown) DECLSPE ...@@ -84,7 +84,7 @@ void d3d10_device_init(struct d3d10_device *device, void *outer_unknown) DECLSPE
/* ID3D10Texture2D */ /* ID3D10Texture2D */
struct d3d10_texture2d struct d3d10_texture2d
{ {
const struct ID3D10Texture2DVtbl *vtbl; ID3D10Texture2D ID3D10Texture2D_iface;
LONG refcount; LONG refcount;
IUnknown *dxgi_surface; IUnknown *dxgi_surface;
......
...@@ -681,7 +681,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *ifac ...@@ -681,7 +681,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *ifac
return hr; return hr;
} }
*texture = (ID3D10Texture2D *)object; *texture = &object->ID3D10Texture2D_iface;
TRACE("Created ID3D10Texture2D %p\n", object); TRACE("Created ID3D10Texture2D %p\n", object);
...@@ -1380,7 +1380,7 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent * ...@@ -1380,7 +1380,7 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
*surface = texture->wined3d_surface; *surface = texture->wined3d_surface;
wined3d_surface_incref(*surface); wined3d_surface_incref(*surface);
ID3D10Texture2D_Release((ID3D10Texture2D *)texture); ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
return S_OK; return S_OK;
} }
...@@ -1423,7 +1423,7 @@ static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_par ...@@ -1423,7 +1423,7 @@ static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_par
*surface = texture->wined3d_surface; *surface = texture->wined3d_surface;
wined3d_surface_incref(*surface); wined3d_surface_incref(*surface);
ID3D10Texture2D_Release((ID3D10Texture2D *)texture); ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
return S_OK; return S_OK;
} }
...@@ -1464,7 +1464,7 @@ static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_pa ...@@ -1464,7 +1464,7 @@ static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_pa
*surface = texture->wined3d_surface; *surface = texture->wined3d_surface;
wined3d_surface_incref(*surface); wined3d_surface_incref(*surface);
ID3D10Texture2D_Release((ID3D10Texture2D *)texture); ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
return S_OK; return S_OK;
} }
......
...@@ -24,11 +24,16 @@ ...@@ -24,11 +24,16 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core); 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 */ /* IUnknown methods */
static HRESULT STDMETHODCALLTYPE d3d10_texture2d_QueryInterface(ID3D10Texture2D *iface, REFIID riid, void **object) 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); TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
...@@ -56,7 +61,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture2d_QueryInterface(ID3D10Texture2D ...@@ -56,7 +61,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture2d_QueryInterface(ID3D10Texture2D
static ULONG STDMETHODCALLTYPE d3d10_texture2d_AddRef(ID3D10Texture2D *iface) 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); ULONG refcount = InterlockedIncrement(&This->refcount);
TRACE("%p increasing refcount to %u\n", 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 ...@@ -77,7 +82,7 @@ static void STDMETHODCALLTYPE d3d10_texture2d_wined3d_object_released(void *pare
static ULONG STDMETHODCALLTYPE d3d10_texture2d_Release(ID3D10Texture2D *iface) 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); ULONG refcount = InterlockedDecrement(&This->refcount);
TRACE("%p decreasing refcount to %u\n", This, refcount); TRACE("%p decreasing refcount to %u\n", This, refcount);
...@@ -166,7 +171,7 @@ static void STDMETHODCALLTYPE d3d10_texture2d_Unmap(ID3D10Texture2D *iface, UINT ...@@ -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) 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); TRACE("iface %p, desc %p\n", iface, desc);
...@@ -204,7 +209,7 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic ...@@ -204,7 +209,7 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
{ {
HRESULT hr; HRESULT hr;
texture->vtbl = &d3d10_texture2d_vtbl; texture->ID3D10Texture2D_iface.lpVtbl = &d3d10_texture2d_vtbl;
texture->refcount = 1; texture->refcount = 1;
texture->desc = *desc; texture->desc = *desc;
...@@ -220,7 +225,7 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic ...@@ -220,7 +225,7 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
} }
hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL, 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); IWineDXGIDevice_Release(wine_device);
if (FAILED(hr)) if (FAILED(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