Michael Stefaniuc : d3d10core: COM cleanup for the ID3D10SamplerState iface .
Alexandre Julliard
julliard at winehq.org
Thu Jun 2 11:22:59 CDT 2011
Module: wine
Branch: master
Commit: db9823e02aebd829b9a98fafb84df4007719dac6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=db9823e02aebd829b9a98fafb84df4007719dac6
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Thu Jun 2 11:23:54 2011 +0200
d3d10core: COM cleanup for the ID3D10SamplerState 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 32d485d..9811315 100644
--- a/dlls/d3d10core/d3d10core_private.h
+++ b/dlls/d3d10core/d3d10core_private.h
@@ -236,7 +236,7 @@ HRESULT d3d10_rasterizer_state_init(struct d3d10_rasterizer_state *state) DECLSP
/* ID3D10SamplerState */
struct d3d10_sampler_state
{
- const struct ID3D10SamplerStateVtbl *vtbl;
+ ID3D10SamplerState ID3D10SamplerState_iface;
LONG refcount;
};
diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index 3523fe0..6af93ae 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -1055,7 +1055,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *i
}
TRACE("Created sampler state %p.\n", object);
- *sampler_state = (ID3D10SamplerState *)object;
+ *sampler_state = &object->ID3D10SamplerState_iface;
return S_OK;
}
diff --git a/dlls/d3d10core/state.c b/dlls/d3d10core/state.c
index 4e77b1d..edb2030 100644
--- a/dlls/d3d10core/state.c
+++ b/dlls/d3d10core/state.c
@@ -372,6 +372,11 @@ HRESULT d3d10_rasterizer_state_init(struct d3d10_rasterizer_state *state)
return S_OK;
}
+static inline struct d3d10_sampler_state *impl_from_ID3D10SamplerState(ID3D10SamplerState *iface)
+{
+ return CONTAINING_RECORD(iface, struct d3d10_sampler_state, ID3D10SamplerState_iface);
+}
+
/* IUnknown methods */
static HRESULT STDMETHODCALLTYPE d3d10_sampler_state_QueryInterface(ID3D10SamplerState *iface,
@@ -396,7 +401,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_sampler_state_QueryInterface(ID3D10Sample
static ULONG STDMETHODCALLTYPE d3d10_sampler_state_AddRef(ID3D10SamplerState *iface)
{
- struct d3d10_sampler_state *This = (struct d3d10_sampler_state *)iface;
+ struct d3d10_sampler_state *This = impl_from_ID3D10SamplerState(iface);
ULONG refcount = InterlockedIncrement(&This->refcount);
TRACE("%p increasing refcount to %u.\n", This, refcount);
@@ -406,7 +411,7 @@ static ULONG STDMETHODCALLTYPE d3d10_sampler_state_AddRef(ID3D10SamplerState *if
static ULONG STDMETHODCALLTYPE d3d10_sampler_state_Release(ID3D10SamplerState *iface)
{
- struct d3d10_sampler_state *This = (struct d3d10_sampler_state *)iface;
+ struct d3d10_sampler_state *This = impl_from_ID3D10SamplerState(iface);
ULONG refcount = InterlockedDecrement(&This->refcount);
TRACE("%p decreasing refcount to %u.\n", This, refcount);
@@ -477,7 +482,7 @@ static const struct ID3D10SamplerStateVtbl d3d10_sampler_state_vtbl =
HRESULT d3d10_sampler_state_init(struct d3d10_sampler_state *state)
{
- state->vtbl = &d3d10_sampler_state_vtbl;
+ state->ID3D10SamplerState_iface.lpVtbl = &d3d10_sampler_state_vtbl;
state->refcount = 1;
return S_OK;
More information about the wine-cvs
mailing list