From c69bb92463493ce5d9058a7f33e161d63ee523fc Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Fri, 3 Jun 2011 11:18:36 +0200 Subject: [PATCH] d3d10: COM cleanup for the ID3D10ShaderReflection iface. --- dlls/d3d10/d3d10_main.c | 4 ++-- dlls/d3d10/d3d10_private.h | 2 +- dlls/d3d10/shader.c | 9 +++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dlls/d3d10/d3d10_main.c b/dlls/d3d10/d3d10_main.c index f153ed37413..9076b0af18e 100644 --- a/dlls/d3d10/d3d10_main.c +++ b/dlls/d3d10/d3d10_main.c @@ -276,10 +276,10 @@ HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10Shad return E_OUTOFMEMORY; } - object->vtbl = &d3d10_shader_reflection_vtbl; + object->ID3D10ShaderReflection_iface.lpVtbl = &d3d10_shader_reflection_vtbl; object->refcount = 1; - *reflector = (ID3D10ShaderReflection *)object; + *reflector = &object->ID3D10ShaderReflection_iface; TRACE("Created ID3D10ShaderReflection %p\n", object); diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h index 1df46114fc4..df525ca0696 100644 --- a/dlls/d3d10/d3d10_private.h +++ b/dlls/d3d10/d3d10_private.h @@ -217,7 +217,7 @@ struct d3d10_effect extern const struct ID3D10ShaderReflectionVtbl d3d10_shader_reflection_vtbl DECLSPEC_HIDDEN; struct d3d10_shader_reflection { - const struct ID3D10ShaderReflectionVtbl *vtbl; + ID3D10ShaderReflection ID3D10ShaderReflection_iface; LONG refcount; }; diff --git a/dlls/d3d10/shader.c b/dlls/d3d10/shader.c index 29d789746c8..499da12e08f 100644 --- a/dlls/d3d10/shader.c +++ b/dlls/d3d10/shader.c @@ -27,6 +27,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d10); /* IUnknown methods */ +static inline struct d3d10_shader_reflection *impl_from_ID3D10ShaderReflection(ID3D10ShaderReflection *iface) +{ + return CONTAINING_RECORD(iface, struct d3d10_shader_reflection, ID3D10ShaderReflection_iface); +} + static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_QueryInterface(ID3D10ShaderReflection *iface, REFIID riid, void **object) { TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object); @@ -47,7 +52,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_QueryInterface(ID3D10Sh static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_AddRef(ID3D10ShaderReflection *iface) { - struct d3d10_shader_reflection *This = (struct d3d10_shader_reflection *)iface; + struct d3d10_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface); ULONG refcount = InterlockedIncrement(&This->refcount); TRACE("%p increasing refcount to %u\n", This, refcount); @@ -57,7 +62,7 @@ static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_AddRef(ID3D10ShaderReflec static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_Release(ID3D10ShaderReflection *iface) { - struct d3d10_shader_reflection *This = (struct d3d10_shader_reflection *)iface; + struct d3d10_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface); ULONG refcount = InterlockedDecrement(&This->refcount); TRACE("%p decreasing refcount to %u\n", This, refcount);