Commit 0b9cfcfc authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

ddrawex: COM cleanup for the IDirectDrawFactory iface.

parent 3799ad34
......@@ -44,15 +44,6 @@ DECLARE_INTERFACE_(IDirectDrawFactory, IUnknown)
#endif
/******************************************************************************
* DirectDrawFactory implementation
******************************************************************************/
typedef struct
{
const IDirectDrawFactoryVtbl *lpVtbl;
LONG ref;
} IDirectDrawFactoryImpl;
HRESULT WINAPI IDirectDrawFactoryImpl_CreateDirectDraw(IDirectDrawFactory* iface,
GUID * pGUID, HWND hWnd, DWORD dwCoopLevelFlags, DWORD dwReserved, IUnknown *pUnkOuter,
IDirectDraw **ppDirectDraw);
......
......@@ -150,16 +150,28 @@ static const IClassFactoryVtbl IClassFactory_Vtbl =
};
/******************************************************************************
* DirectDrawFactory implementation
******************************************************************************/
typedef struct
{
IDirectDrawFactory IDirectDrawFactory_iface;
LONG ref;
} IDirectDrawFactoryImpl;
static inline IDirectDrawFactoryImpl *impl_from_IDirectDrawFactory(IDirectDrawFactory *iface)
{
return CONTAINING_RECORD(iface, IDirectDrawFactoryImpl, IDirectDrawFactory_iface);
}
/*******************************************************************************
* IDirectDrawFactory::QueryInterface
*
*******************************************************************************/
static HRESULT WINAPI
IDirectDrawFactoryImpl_QueryInterface(IDirectDrawFactory *iface,
REFIID riid,
void **obj)
static HRESULT WINAPI IDirectDrawFactoryImpl_QueryInterface(IDirectDrawFactory *iface, REFIID riid,
void **obj)
{
IDirectDrawFactoryImpl *This = (IDirectDrawFactoryImpl*) iface;
IDirectDrawFactoryImpl *This = impl_from_IDirectDrawFactory(iface);
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), obj);
......@@ -179,10 +191,9 @@ IDirectDrawFactoryImpl_QueryInterface(IDirectDrawFactory *iface,
* IDirectDrawFactory::AddRef
*
*******************************************************************************/
static ULONG WINAPI
IDirectDrawFactoryImpl_AddRef(IDirectDrawFactory *iface)
static ULONG WINAPI IDirectDrawFactoryImpl_AddRef(IDirectDrawFactory *iface)
{
IDirectDrawFactoryImpl *This = (IDirectDrawFactoryImpl*) iface;
IDirectDrawFactoryImpl *This = impl_from_IDirectDrawFactory(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->() incrementing from %d.\n", This, ref - 1);
......@@ -194,11 +205,11 @@ IDirectDrawFactoryImpl_AddRef(IDirectDrawFactory *iface)
* IDirectDrawFactory::Release
*
*******************************************************************************/
static ULONG WINAPI
IDirectDrawFactoryImpl_Release(IDirectDrawFactory *iface)
static ULONG WINAPI IDirectDrawFactoryImpl_Release(IDirectDrawFactory *iface)
{
IDirectDrawFactoryImpl *This = (IDirectDrawFactoryImpl*) iface;
IDirectDrawFactoryImpl *This = impl_from_IDirectDrawFactory(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->() decrementing from %d.\n", This, ref+1);
if (ref == 0)
......@@ -255,9 +266,9 @@ CreateDirectDrawFactory(IUnknown* UnkOuter, REFIID iid, void **obj)
return E_OUTOFMEMORY;
}
This->lpVtbl = &IDirectDrawFactory_Vtbl;
This->IDirectDrawFactory_iface.lpVtbl = &IDirectDrawFactory_Vtbl;
hr = IDirectDrawFactory_QueryInterface((IDirectDrawFactory *)This, iid, obj);
hr = IDirectDrawFactory_QueryInterface(&This->IDirectDrawFactory_iface, iid, obj);
if (FAILED(hr))
HeapFree(GetProcessHeap(), 0, This);
......
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