[PATCH 3/6] d3d10core: COM cleanup for the ID3D10DepthStencilView iface.

Michael Stefaniuc mstefani at redhat.de
Wed Jun 1 03:37:49 CDT 2011


---
 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 c6f13b1..ba6103e 100644
--- a/dlls/d3d10core/d3d10core_private.h
+++ b/dlls/d3d10core/d3d10core_private.h
@@ -123,7 +123,7 @@ HRESULT d3d10_buffer_init(struct d3d10_buffer *buffer, struct d3d10_device *devi
 /* ID3D10DepthStencilView */
 struct d3d10_depthstencil_view
 {
-    const struct ID3D10DepthStencilViewVtbl *vtbl;
+    ID3D10DepthStencilView ID3D10DepthStencilView_iface;
     LONG refcount;
 };
 
diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index f1ba7de..42dcfd3 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -800,7 +800,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Devic
     }
 
     TRACE("Created depthstencil view %p.\n", object);
-    *view = (ID3D10DepthStencilView *)object;
+    *view = &object->ID3D10DepthStencilView_iface;
 
     return S_OK;
 }
diff --git a/dlls/d3d10core/view.c b/dlls/d3d10core/view.c
index d469ae5..282bc24 100644
--- a/dlls/d3d10core/view.c
+++ b/dlls/d3d10core/view.c
@@ -164,6 +164,11 @@ static HRESULT set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3
     }
 }
 
+static inline struct d3d10_depthstencil_view *impl_from_ID3D10DepthStencilView(ID3D10DepthStencilView *iface)
+{
+    return CONTAINING_RECORD(iface, struct d3d10_depthstencil_view, ID3D10DepthStencilView_iface);
+}
+
 /* IUnknown methods */
 
 static HRESULT STDMETHODCALLTYPE d3d10_depthstencil_view_QueryInterface(ID3D10DepthStencilView *iface,
@@ -189,7 +194,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_depthstencil_view_QueryInterface(ID3D10De
 
 static ULONG STDMETHODCALLTYPE d3d10_depthstencil_view_AddRef(ID3D10DepthStencilView *iface)
 {
-    struct d3d10_depthstencil_view *This = (struct d3d10_depthstencil_view *)iface;
+    struct d3d10_depthstencil_view *This = impl_from_ID3D10DepthStencilView(iface);
     ULONG refcount = InterlockedIncrement(&This->refcount);
 
     TRACE("%p increasing refcount to %u.\n", This, refcount);
@@ -199,7 +204,7 @@ static ULONG STDMETHODCALLTYPE d3d10_depthstencil_view_AddRef(ID3D10DepthStencil
 
 static ULONG STDMETHODCALLTYPE d3d10_depthstencil_view_Release(ID3D10DepthStencilView *iface)
 {
-    struct d3d10_depthstencil_view *This = (struct d3d10_depthstencil_view *)iface;
+    struct d3d10_depthstencil_view *This = impl_from_ID3D10DepthStencilView(iface);
     ULONG refcount = InterlockedDecrement(&This->refcount);
 
     TRACE("%p decreasing refcount to %u.\n", This, refcount);
@@ -280,7 +285,7 @@ static const struct ID3D10DepthStencilViewVtbl d3d10_depthstencil_view_vtbl =
 
 HRESULT d3d10_depthstencil_view_init(struct d3d10_depthstencil_view *view)
 {
-    view->vtbl = &d3d10_depthstencil_view_vtbl;
+    view->ID3D10DepthStencilView_iface.lpVtbl = &d3d10_depthstencil_view_vtbl;
     view->refcount = 1;
 
     return S_OK;
-- 
1.7.4.4



More information about the wine-patches mailing list