Michael Stefaniuc : d3d10core: COM cleanup for the ID3D10BlendState iface.
Alexandre Julliard
julliard at winehq.org
Wed Jun 1 12:11:07 CDT 2011
Module: wine
Branch: master
Commit: a4a4a420f8fd66b96b2447e1d3203c224174f323
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a4a4a420f8fd66b96b2447e1d3203c224174f323
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Wed Jun 1 11:02:35 2011 +0200
d3d10core: COM cleanup for the ID3D10BlendState 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 12af282..d3be62b 100644
--- a/dlls/d3d10core/d3d10core_private.h
+++ b/dlls/d3d10core/d3d10core_private.h
@@ -209,7 +209,7 @@ void shader_free_signature(struct wined3d_shader_signature *s) DECLSPEC_HIDDEN;
/* ID3D10BlendState */
struct d3d10_blend_state
{
- const struct ID3D10BlendStateVtbl *vtbl;
+ ID3D10BlendState ID3D10BlendState_iface;
LONG refcount;
};
diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index 59a3b60..bec59ce 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -968,7 +968,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *ifa
}
TRACE("Created blend state %p.\n", object);
- *blend_state = (ID3D10BlendState *)object;
+ *blend_state = &object->ID3D10BlendState_iface;
return S_OK;
}
diff --git a/dlls/d3d10core/state.c b/dlls/d3d10core/state.c
index 2eaa652..5051f11 100644
--- a/dlls/d3d10core/state.c
+++ b/dlls/d3d10core/state.c
@@ -24,6 +24,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
+static inline struct d3d10_blend_state *impl_from_ID3D10BlendState(ID3D10BlendState *iface)
+{
+ return CONTAINING_RECORD(iface, struct d3d10_blend_state, ID3D10BlendState_iface);
+}
+
/* IUnknown methods */
static HRESULT STDMETHODCALLTYPE d3d10_blend_state_QueryInterface(ID3D10BlendState *iface,
@@ -48,7 +53,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_blend_state_QueryInterface(ID3D10BlendSta
static ULONG STDMETHODCALLTYPE d3d10_blend_state_AddRef(ID3D10BlendState *iface)
{
- struct d3d10_blend_state *This = (struct d3d10_blend_state *)iface;
+ struct d3d10_blend_state *This = impl_from_ID3D10BlendState(iface);
ULONG refcount = InterlockedIncrement(&This->refcount);
TRACE("%p increasing refcount to %u.\n", This, refcount);
@@ -58,7 +63,7 @@ static ULONG STDMETHODCALLTYPE d3d10_blend_state_AddRef(ID3D10BlendState *iface)
static ULONG STDMETHODCALLTYPE d3d10_blend_state_Release(ID3D10BlendState *iface)
{
- struct d3d10_blend_state *This = (struct d3d10_blend_state *)iface;
+ struct d3d10_blend_state *This = impl_from_ID3D10BlendState(iface);
ULONG refcount = InterlockedDecrement(&This->refcount);
TRACE("%p decreasing refcount to %u.\n", This, refcount);
@@ -129,7 +134,7 @@ static const struct ID3D10BlendStateVtbl d3d10_blend_state_vtbl =
HRESULT d3d10_blend_state_init(struct d3d10_blend_state *state)
{
- state->vtbl = &d3d10_blend_state_vtbl;
+ state->ID3D10BlendState_iface.lpVtbl = &d3d10_blend_state_vtbl;
state->refcount = 1;
return S_OK;
More information about the wine-cvs
mailing list