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

Alexandre Julliard julliard at winehq.org
Wed Jun 1 12:11:07 CDT 2011


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Wed Jun  1 10:59:33 2011 +0200

d3d10core: COM cleanup for the ID3D10GeometryShader iface.

---

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

diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h
index 0640556..12af282 100644
--- a/dlls/d3d10core/d3d10core_private.h
+++ b/dlls/d3d10core/d3d10core_private.h
@@ -180,7 +180,7 @@ HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d1
 /* ID3D10GeometryShader */
 struct d3d10_geometry_shader
 {
-    const struct ID3D10GeometryShaderVtbl *vtbl;
+    ID3D10GeometryShader ID3D10GeometryShader_iface;
     LONG refcount;
 
     struct wined3d_shader *wined3d_shader;
diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index bc8d31f..59a3b60 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -896,7 +896,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device
     }
 
     TRACE("Created geometry shader %p.\n", object);
-    *shader = (ID3D10GeometryShader *)object;
+    *shader = &object->ID3D10GeometryShader_iface;
 
     return S_OK;
 }
diff --git a/dlls/d3d10core/shader.c b/dlls/d3d10core/shader.c
index eec420c..a7a40d5 100644
--- a/dlls/d3d10core/shader.c
+++ b/dlls/d3d10core/shader.c
@@ -267,6 +267,11 @@ HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d1
     return S_OK;
 }
 
+static inline struct d3d10_geometry_shader *impl_from_ID3D10GeometryShader(ID3D10GeometryShader *iface)
+{
+    return CONTAINING_RECORD(iface, struct d3d10_geometry_shader, ID3D10GeometryShader_iface);
+}
+
 /* IUnknown methods */
 
 static HRESULT STDMETHODCALLTYPE d3d10_geometry_shader_QueryInterface(ID3D10GeometryShader *iface,
@@ -291,7 +296,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_geometry_shader_QueryInterface(ID3D10Geom
 
 static ULONG STDMETHODCALLTYPE d3d10_geometry_shader_AddRef(ID3D10GeometryShader *iface)
 {
-    struct d3d10_geometry_shader *This = (struct d3d10_geometry_shader *)iface;
+    struct d3d10_geometry_shader *This = impl_from_ID3D10GeometryShader(iface);
     ULONG refcount = InterlockedIncrement(&This->refcount);
 
     TRACE("%p increasing refcount to %u\n", This, refcount);
@@ -301,7 +306,7 @@ static ULONG STDMETHODCALLTYPE d3d10_geometry_shader_AddRef(ID3D10GeometryShader
 
 static ULONG STDMETHODCALLTYPE d3d10_geometry_shader_Release(ID3D10GeometryShader *iface)
 {
-    struct d3d10_geometry_shader *This = (struct d3d10_geometry_shader *)iface;
+    struct d3d10_geometry_shader *This = impl_from_ID3D10GeometryShader(iface);
     ULONG refcount = InterlockedDecrement(&This->refcount);
 
     TRACE("%p decreasing refcount to %u\n", This, refcount);
@@ -376,7 +381,7 @@ HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct
     struct d3d10_shader_info shader_info;
     HRESULT hr;
 
-    shader->vtbl = &d3d10_geometry_shader_vtbl;
+    shader->ID3D10GeometryShader_iface.lpVtbl = &d3d10_geometry_shader_vtbl;
     shader->refcount = 1;
 
     shader_info.output_signature = &shader->output_signature;




More information about the wine-cvs mailing list