Michael Stefaniuc : d3d10core: COM cleanup for the ID3D10ShaderResourceView iface.
Alexandre Julliard
julliard at winehq.org
Wed Jun 1 12:11:07 CDT 2011
Module: wine
Branch: master
Commit: 36de21b3a1ed854bc2d9929c4b9eebaffb2bf0ad
URL: http://source.winehq.org/git/wine.git/?a=commit;h=36de21b3a1ed854bc2d9929c4b9eebaffb2bf0ad
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Wed Jun 1 10:46:00 2011 +0200
d3d10core: COM cleanup for the ID3D10ShaderResourceView iface.
---
dlls/d3d10core/d3d10core_private.h | 2 +-
dlls/d3d10core/device.c | 2 +-
dlls/d3d10core/view.c | 11 ++++++++---
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h
index ba6103e..0640556 100644
--- a/dlls/d3d10core/d3d10core_private.h
+++ b/dlls/d3d10core/d3d10core_private.h
@@ -145,7 +145,7 @@ HRESULT d3d10_rendertarget_view_init(struct d3d10_rendertarget_view *view,
/* ID3D10ShaderResourceView */
struct d3d10_shader_resource_view
{
- const struct ID3D10ShaderResourceViewVtbl *vtbl;
+ ID3D10ShaderResourceView ID3D10ShaderResourceView_iface;
LONG refcount;
};
diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index 42dcfd3..bc8d31f 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -742,7 +742,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Dev
}
TRACE("Created shader resource view %p.\n", object);
- *view = (ID3D10ShaderResourceView *)object;
+ *view = &object->ID3D10ShaderResourceView_iface;
return S_OK;
}
diff --git a/dlls/d3d10core/view.c b/dlls/d3d10core/view.c
index 282bc24..fb289a6 100644
--- a/dlls/d3d10core/view.c
+++ b/dlls/d3d10core/view.c
@@ -468,6 +468,11 @@ HRESULT d3d10_rendertarget_view_init(struct d3d10_rendertarget_view *view,
return S_OK;
}
+static inline struct d3d10_shader_resource_view *impl_from_ID3D10ShaderResourceView(ID3D10ShaderResourceView *iface)
+{
+ return CONTAINING_RECORD(iface, struct d3d10_shader_resource_view, ID3D10ShaderResourceView_iface);
+}
+
/* IUnknown methods */
static HRESULT STDMETHODCALLTYPE d3d10_shader_resource_view_QueryInterface(ID3D10ShaderResourceView *iface,
@@ -493,7 +498,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_resource_view_QueryInterface(ID3D1
static ULONG STDMETHODCALLTYPE d3d10_shader_resource_view_AddRef(ID3D10ShaderResourceView *iface)
{
- struct d3d10_shader_resource_view *This = (struct d3d10_shader_resource_view *)iface;
+ struct d3d10_shader_resource_view *This = impl_from_ID3D10ShaderResourceView(iface);
ULONG refcount = InterlockedIncrement(&This->refcount);
TRACE("%p increasing refcount to %u.\n", This, refcount);
@@ -503,7 +508,7 @@ static ULONG STDMETHODCALLTYPE d3d10_shader_resource_view_AddRef(ID3D10ShaderRes
static ULONG STDMETHODCALLTYPE d3d10_shader_resource_view_Release(ID3D10ShaderResourceView *iface)
{
- struct d3d10_shader_resource_view *This = (struct d3d10_shader_resource_view *)iface;
+ struct d3d10_shader_resource_view *This = impl_from_ID3D10ShaderResourceView(iface);
ULONG refcount = InterlockedDecrement(&This->refcount);
TRACE("%p decreasing refcount to %u.\n", This, refcount);
@@ -585,7 +590,7 @@ static const struct ID3D10ShaderResourceViewVtbl d3d10_shader_resource_view_vtbl
HRESULT d3d10_shader_resource_view_init(struct d3d10_shader_resource_view *view)
{
- view->vtbl = &d3d10_shader_resource_view_vtbl;
+ view->ID3D10ShaderResourceView_iface.lpVtbl = &d3d10_shader_resource_view_vtbl;
view->refcount = 1;
return S_OK;
More information about the wine-cvs
mailing list