Commit a991b670 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

d3d9: COM cleanup for the IDirect3DStateBlock9 iface.

parent 78ea105b
......@@ -377,15 +377,14 @@ HRESULT volumetexture_init(IDirect3DVolumeTexture9Impl *texture, IDirect3DDevice
* IDirect3DStateBlock9 implementation structure
*/
typedef struct IDirect3DStateBlock9Impl {
/* IUnknown fields */
const IDirect3DStateBlock9Vtbl *lpVtbl;
IDirect3DStateBlock9 IDirect3DStateBlock9_iface;
LONG ref;
/* IDirect3DStateBlock9 fields */
struct wined3d_stateblock *wined3d_stateblock;
/* Parent reference */
LPDIRECT3DDEVICE9EX parentDevice;
IDirect3DDevice9Ex *parentDevice;
} IDirect3DStateBlock9Impl;
HRESULT stateblock_init(IDirect3DStateBlock9Impl *stateblock, IDirect3DDevice9Impl *device,
......
......@@ -1509,7 +1509,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(IDirect3DDevice9Ex *
}
TRACE("Created stateblock %p.\n", object);
*stateblock = (IDirect3DStateBlock9 *)object;
*stateblock = &object->IDirect3DStateBlock9_iface;
return D3D_OK;
}
......@@ -1568,7 +1568,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(IDirect3DDevice9Ex *ifa
}
TRACE("Created stateblock %p.\n", object);
*stateblock = (IDirect3DStateBlock9 *)object;
*stateblock = &object->IDirect3DStateBlock9_iface;
return D3D_OK;
}
......
......@@ -25,9 +25,15 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
/* IDirect3DStateBlock9 IUnknown parts follow: */
static HRESULT WINAPI IDirect3DStateBlock9Impl_QueryInterface(LPDIRECT3DSTATEBLOCK9 iface, REFIID riid, LPVOID* ppobj) {
IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface;
static inline IDirect3DStateBlock9Impl *impl_from_IDirect3DStateBlock9(IDirect3DStateBlock9 *iface)
{
return CONTAINING_RECORD(iface, IDirect3DStateBlock9Impl, IDirect3DStateBlock9_iface);
}
static HRESULT WINAPI IDirect3DStateBlock9Impl_QueryInterface(IDirect3DStateBlock9 *iface,
REFIID riid, void **ppobj)
{
IDirect3DStateBlock9Impl *This = impl_from_IDirect3DStateBlock9(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj);
......@@ -43,8 +49,9 @@ static HRESULT WINAPI IDirect3DStateBlock9Impl_QueryInterface(LPDIRECT3DSTATEBLO
return E_NOINTERFACE;
}
static ULONG WINAPI IDirect3DStateBlock9Impl_AddRef(LPDIRECT3DSTATEBLOCK9 iface) {
IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface;
static ULONG WINAPI IDirect3DStateBlock9Impl_AddRef(IDirect3DStateBlock9 *iface)
{
IDirect3DStateBlock9Impl *This = impl_from_IDirect3DStateBlock9(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("%p increasing refcount to %u.\n", iface, ref);
......@@ -52,8 +59,9 @@ static ULONG WINAPI IDirect3DStateBlock9Impl_AddRef(LPDIRECT3DSTATEBLOCK9 iface)
return ref;
}
static ULONG WINAPI IDirect3DStateBlock9Impl_Release(LPDIRECT3DSTATEBLOCK9 iface) {
IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface;
static ULONG WINAPI IDirect3DStateBlock9Impl_Release(IDirect3DStateBlock9 *iface)
{
IDirect3DStateBlock9Impl *This = impl_from_IDirect3DStateBlock9(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("%p decreasing refcount to %u.\n", iface, ref);
......@@ -70,9 +78,10 @@ static ULONG WINAPI IDirect3DStateBlock9Impl_Release(LPDIRECT3DSTATEBLOCK9 iface
}
/* IDirect3DStateBlock9 Interface follow: */
static HRESULT WINAPI IDirect3DStateBlock9Impl_GetDevice(IDirect3DStateBlock9 *iface, IDirect3DDevice9 **device)
static HRESULT WINAPI IDirect3DStateBlock9Impl_GetDevice(IDirect3DStateBlock9 *iface,
IDirect3DDevice9 **device)
{
IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface;
IDirect3DStateBlock9Impl *This = impl_from_IDirect3DStateBlock9(iface);
TRACE("iface %p, device %p.\n", iface, device);
......@@ -84,8 +93,9 @@ static HRESULT WINAPI IDirect3DStateBlock9Impl_GetDevice(IDirect3DStateBlock9 *i
return D3D_OK;
}
static HRESULT WINAPI IDirect3DStateBlock9Impl_Capture(LPDIRECT3DSTATEBLOCK9 iface) {
IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface;
static HRESULT WINAPI IDirect3DStateBlock9Impl_Capture(IDirect3DStateBlock9 *iface)
{
IDirect3DStateBlock9Impl *This = impl_from_IDirect3DStateBlock9(iface);
HRESULT hr;
TRACE("iface %p.\n", iface);
......@@ -97,8 +107,9 @@ static HRESULT WINAPI IDirect3DStateBlock9Impl_Capture(LPDIRECT3DSTATEBLOCK9 ifa
return hr;
}
static HRESULT WINAPI IDirect3DStateBlock9Impl_Apply(LPDIRECT3DSTATEBLOCK9 iface) {
IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface;
static HRESULT WINAPI IDirect3DStateBlock9Impl_Apply(IDirect3DStateBlock9 *iface)
{
IDirect3DStateBlock9Impl *This = impl_from_IDirect3DStateBlock9(iface);
HRESULT hr;
TRACE("iface %p.\n", iface);
......@@ -128,7 +139,7 @@ HRESULT stateblock_init(IDirect3DStateBlock9Impl *stateblock, IDirect3DDevice9Im
{
HRESULT hr;
stateblock->lpVtbl = &Direct3DStateBlock9_Vtbl;
stateblock->IDirect3DStateBlock9_iface.lpVtbl = &Direct3DStateBlock9_Vtbl;
stateblock->ref = 1;
if (wined3d_stateblock)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment