Michael Stefaniuc : d3d10core: COM cleanup for the ID3D10DepthStencilState iface.

Alexandre Julliard julliard at winehq.org
Thu Jun 2 11:22:59 CDT 2011


Module: wine
Branch: master
Commit: 815470e68b7a1fe75291a69b79297f59e046ff6d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=815470e68b7a1fe75291a69b79297f59e046ff6d

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Thu Jun  2 11:21:30 2011 +0200

d3d10core: COM cleanup for the ID3D10DepthStencilState iface.

---

 dlls/d3d10core/d3d10core_private.h |    2 +-
 dlls/d3d10core/device.c            |    2 +-
 dlls/d3d10core/state.c             |   11 ++++++++---
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h
index d3be62b..6be41cf 100644
--- a/dlls/d3d10core/d3d10core_private.h
+++ b/dlls/d3d10core/d3d10core_private.h
@@ -218,7 +218,7 @@ HRESULT d3d10_blend_state_init(struct d3d10_blend_state *state) DECLSPEC_HIDDEN;
 /* ID3D10DepthStencilState */
 struct d3d10_depthstencil_state
 {
-    const struct ID3D10DepthStencilStateVtbl *vtbl;
+    ID3D10DepthStencilState ID3D10DepthStencilState_iface;
     LONG refcount;
 };
 
diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index bec59ce..9dae3aa 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -997,7 +997,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Devi
     }
 
     TRACE("Created depthstencil state %p.\n", object);
-    *depth_stencil_state = (ID3D10DepthStencilState *)object;
+    *depth_stencil_state = &object->ID3D10DepthStencilState_iface;
 
     return S_OK;
 }
diff --git a/dlls/d3d10core/state.c b/dlls/d3d10core/state.c
index 5051f11..6fc7f17 100644
--- a/dlls/d3d10core/state.c
+++ b/dlls/d3d10core/state.c
@@ -140,6 +140,11 @@ HRESULT d3d10_blend_state_init(struct d3d10_blend_state *state)
     return S_OK;
 }
 
+static inline struct d3d10_depthstencil_state *impl_from_ID3D10DepthStencilState(ID3D10DepthStencilState *iface)
+{
+    return CONTAINING_RECORD(iface, struct d3d10_depthstencil_state, ID3D10DepthStencilState_iface);
+}
+
 /* IUnknown methods */
 
 static HRESULT STDMETHODCALLTYPE d3d10_depthstencil_state_QueryInterface(ID3D10DepthStencilState *iface,
@@ -164,7 +169,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_depthstencil_state_QueryInterface(ID3D10D
 
 static ULONG STDMETHODCALLTYPE d3d10_depthstencil_state_AddRef(ID3D10DepthStencilState *iface)
 {
-    struct d3d10_depthstencil_state *This = (struct d3d10_depthstencil_state *)iface;
+    struct d3d10_depthstencil_state *This = impl_from_ID3D10DepthStencilState(iface);
     ULONG refcount = InterlockedIncrement(&This->refcount);
 
     TRACE("%p increasing refcount to %u.\n", This, refcount);
@@ -174,7 +179,7 @@ static ULONG STDMETHODCALLTYPE d3d10_depthstencil_state_AddRef(ID3D10DepthStenci
 
 static ULONG STDMETHODCALLTYPE d3d10_depthstencil_state_Release(ID3D10DepthStencilState *iface)
 {
-    struct d3d10_depthstencil_state *This = (struct d3d10_depthstencil_state *)iface;
+    struct d3d10_depthstencil_state *This = impl_from_ID3D10DepthStencilState(iface);
     ULONG refcount = InterlockedDecrement(&This->refcount);
 
     TRACE("%p decreasing refcount to %u.\n", This, refcount);
@@ -245,7 +250,7 @@ static const struct ID3D10DepthStencilStateVtbl d3d10_depthstencil_state_vtbl =
 
 HRESULT d3d10_depthstencil_state_init(struct d3d10_depthstencil_state *state)
 {
-    state->vtbl = &d3d10_depthstencil_state_vtbl;
+    state->ID3D10DepthStencilState_iface.lpVtbl = &d3d10_depthstencil_state_vtbl;
     state->refcount = 1;
 
     return S_OK;




More information about the wine-cvs mailing list