Commit 588ddee7 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

ddraw: COM cleanup for the IDirectDrawClipper iface.

parent 92b467cd
...@@ -26,9 +26,10 @@ ...@@ -26,9 +26,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddraw); WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
/***************************************************************************** static inline IDirectDrawClipperImpl *impl_from_IDirectDrawClipper(IDirectDrawClipper *iface)
* IUnknown methods {
*****************************************************************************/ return CONTAINING_RECORD(iface, IDirectDrawClipperImpl, IDirectDrawClipper_iface);
}
/***************************************************************************** /*****************************************************************************
* IDirectDrawClipper::QueryInterface * IDirectDrawClipper::QueryInterface
...@@ -46,9 +47,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw); ...@@ -46,9 +47,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
* E_NOINTERFACE if the requested interface wasn't found. * E_NOINTERFACE if the requested interface wasn't found.
* *
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI IDirectDrawClipperImpl_QueryInterface( static HRESULT WINAPI IDirectDrawClipperImpl_QueryInterface(IDirectDrawClipper *iface, REFIID riid,
LPDIRECTDRAWCLIPPER iface, REFIID riid, LPVOID* ppvObj void **ppvObj)
) { {
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppvObj); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppvObj);
...@@ -69,9 +70,9 @@ static HRESULT WINAPI IDirectDrawClipperImpl_QueryInterface( ...@@ -69,9 +70,9 @@ static HRESULT WINAPI IDirectDrawClipperImpl_QueryInterface(
* Increases the reference count of the interface, returns the new count * Increases the reference count of the interface, returns the new count
* *
*****************************************************************************/ *****************************************************************************/
static ULONG WINAPI IDirectDrawClipperImpl_AddRef( LPDIRECTDRAWCLIPPER iface ) static ULONG WINAPI IDirectDrawClipperImpl_AddRef(IDirectDrawClipper *iface)
{ {
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface; IDirectDrawClipperImpl *This = impl_from_IDirectDrawClipper(iface);
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("%p increasing refcount to %u.\n", This, ref); TRACE("%p increasing refcount to %u.\n", This, ref);
...@@ -86,8 +87,9 @@ static ULONG WINAPI IDirectDrawClipperImpl_AddRef( LPDIRECTDRAWCLIPPER iface ) ...@@ -86,8 +87,9 @@ static ULONG WINAPI IDirectDrawClipperImpl_AddRef( LPDIRECTDRAWCLIPPER iface )
* If the refcount is decreased to 0, the interface is destroyed. * If the refcount is decreased to 0, the interface is destroyed.
* *
*****************************************************************************/ *****************************************************************************/
static ULONG WINAPI IDirectDrawClipperImpl_Release(IDirectDrawClipper *iface) { static ULONG WINAPI IDirectDrawClipperImpl_Release(IDirectDrawClipper *iface)
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface; {
IDirectDrawClipperImpl *This = impl_from_IDirectDrawClipper(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("%p decreasing refcount to %u.\n", This, ref); TRACE("%p decreasing refcount to %u.\n", This, ref);
...@@ -118,10 +120,10 @@ static ULONG WINAPI IDirectDrawClipperImpl_Release(IDirectDrawClipper *iface) { ...@@ -118,10 +120,10 @@ static ULONG WINAPI IDirectDrawClipperImpl_Release(IDirectDrawClipper *iface) {
* *
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI IDirectDrawClipperImpl_SetHwnd( static HRESULT WINAPI IDirectDrawClipperImpl_SetHwnd(IDirectDrawClipper *iface, DWORD dwFlags,
LPDIRECTDRAWCLIPPER iface, DWORD dwFlags, HWND hWnd HWND hWnd)
) { {
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface; IDirectDrawClipperImpl *This = impl_from_IDirectDrawClipper(iface);
HRESULT hr; HRESULT hr;
TRACE("iface %p, flags %#x, window %p.\n", iface, dwFlags, hWnd); TRACE("iface %p, flags %#x, window %p.\n", iface, dwFlags, hWnd);
...@@ -154,11 +156,10 @@ static HRESULT WINAPI IDirectDrawClipperImpl_SetHwnd( ...@@ -154,11 +156,10 @@ static HRESULT WINAPI IDirectDrawClipperImpl_SetHwnd(
* RETURNS * RETURNS
* Either DD_OK or DDERR_* * Either DD_OK or DDERR_*
************************************************************************/ ************************************************************************/
static HRESULT WINAPI IDirectDrawClipperImpl_GetClipList( static HRESULT WINAPI IDirectDrawClipperImpl_GetClipList(IDirectDrawClipper *iface, RECT *lpRect,
LPDIRECTDRAWCLIPPER iface, LPRECT lpRect, LPRGNDATA lpClipList, RGNDATA *lpClipList, DWORD *lpdwSize)
LPDWORD lpdwSize)
{ {
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface; IDirectDrawClipperImpl *This = impl_from_IDirectDrawClipper(iface);
HRESULT hr; HRESULT hr;
TRACE("iface %p, rect %s, clip_list %p, clip_list_size %p.\n", TRACE("iface %p, rect %s, clip_list %p, clip_list_size %p.\n",
...@@ -184,10 +185,10 @@ static HRESULT WINAPI IDirectDrawClipperImpl_GetClipList( ...@@ -184,10 +185,10 @@ static HRESULT WINAPI IDirectDrawClipperImpl_GetClipList(
* RETURNS * RETURNS
* Either DD_OK or DDERR_* * Either DD_OK or DDERR_*
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI IDirectDrawClipperImpl_SetClipList( static HRESULT WINAPI IDirectDrawClipperImpl_SetClipList(IDirectDrawClipper *iface, RGNDATA *lprgn,
LPDIRECTDRAWCLIPPER iface,LPRGNDATA lprgn,DWORD dwFlag DWORD dwFlag)
) { {
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface; IDirectDrawClipperImpl *This = impl_from_IDirectDrawClipper(iface);
HRESULT hr; HRESULT hr;
TRACE("iface %p, clip_list %p, flags %#x.\n", iface, lprgn, dwFlag); TRACE("iface %p, clip_list %p, flags %#x.\n", iface, lprgn, dwFlag);
...@@ -209,10 +210,9 @@ static HRESULT WINAPI IDirectDrawClipperImpl_SetClipList( ...@@ -209,10 +210,9 @@ static HRESULT WINAPI IDirectDrawClipperImpl_SetClipList(
* Return values: * Return values:
* Always returns DD_OK; * Always returns DD_OK;
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI IDirectDrawClipperImpl_GetHWnd( static HRESULT WINAPI IDirectDrawClipperImpl_GetHWnd(IDirectDrawClipper *iface, HWND *hWndPtr)
LPDIRECTDRAWCLIPPER iface, HWND* hWndPtr {
) { IDirectDrawClipperImpl *This = impl_from_IDirectDrawClipper(iface);
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
HRESULT hr; HRESULT hr;
TRACE("iface %p, window %p.\n", iface, hWndPtr); TRACE("iface %p, window %p.\n", iface, hWndPtr);
...@@ -237,12 +237,12 @@ static HRESULT WINAPI IDirectDrawClipperImpl_GetHWnd( ...@@ -237,12 +237,12 @@ static HRESULT WINAPI IDirectDrawClipperImpl_GetHWnd(
* DD_OK on success * DD_OK on success
* DDERR_ALREADYINITIALIZED if this interface isn't initialized already * DDERR_ALREADYINITIALIZED if this interface isn't initialized already
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI IDirectDrawClipperImpl_Initialize( static HRESULT WINAPI IDirectDrawClipperImpl_Initialize(IDirectDrawClipper *iface,
LPDIRECTDRAWCLIPPER iface, LPDIRECTDRAW lpDD, DWORD dwFlags IDirectDraw *ddraw, DWORD dwFlags)
) { {
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface; IDirectDrawClipperImpl *This = impl_from_IDirectDrawClipper(iface);
TRACE("iface %p, ddraw %p, flags %#x.\n", iface, lpDD, dwFlags); TRACE("iface %p, ddraw %p, flags %#x.\n", iface, ddraw, dwFlags);
EnterCriticalSection(&ddraw_cs); EnterCriticalSection(&ddraw_cs);
if (This->initialized) if (This->initialized)
...@@ -268,9 +268,9 @@ static HRESULT WINAPI IDirectDrawClipperImpl_Initialize( ...@@ -268,9 +268,9 @@ static HRESULT WINAPI IDirectDrawClipperImpl_Initialize(
* Return values: * Return values:
* DD_OK, because it's a stub * DD_OK, because it's a stub
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI IDirectDrawClipperImpl_IsClipListChanged( static HRESULT WINAPI IDirectDrawClipperImpl_IsClipListChanged(IDirectDrawClipper *iface,
LPDIRECTDRAWCLIPPER iface, BOOL* lpbChanged BOOL *lpbChanged)
) { {
FIXME("iface %p, changed %p stub!\n", iface, lpbChanged); FIXME("iface %p, changed %p stub!\n", iface, lpbChanged);
/* XXX What is safest? */ /* XXX What is safest? */
...@@ -297,7 +297,7 @@ static const struct IDirectDrawClipperVtbl ddraw_clipper_vtbl = ...@@ -297,7 +297,7 @@ static const struct IDirectDrawClipperVtbl ddraw_clipper_vtbl =
HRESULT ddraw_clipper_init(IDirectDrawClipperImpl *clipper) HRESULT ddraw_clipper_init(IDirectDrawClipperImpl *clipper)
{ {
clipper->lpVtbl = &ddraw_clipper_vtbl; clipper->IDirectDrawClipper_iface.lpVtbl = &ddraw_clipper_vtbl;
clipper->ref = 1; clipper->ref = 1;
clipper->wineD3DClipper = wined3d_clipper_create(); clipper->wineD3DClipper = wined3d_clipper_create();
if (!clipper->wineD3DClipper) if (!clipper->wineD3DClipper)
......
...@@ -3997,7 +3997,7 @@ DirectDrawCreateClipper(DWORD Flags, ...@@ -3997,7 +3997,7 @@ DirectDrawCreateClipper(DWORD Flags,
} }
TRACE("Created clipper %p.\n", object); TRACE("Created clipper %p.\n", object);
*Clipper = (IDirectDrawClipper *) object; *Clipper = &object->IDirectDrawClipper_iface;
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
} }
......
...@@ -358,8 +358,7 @@ static inline IDirect3DDeviceImpl *device_from_device3(IDirect3DDevice3 *iface) ...@@ -358,8 +358,7 @@ static inline IDirect3DDeviceImpl *device_from_device3(IDirect3DDevice3 *iface)
*****************************************************************************/ *****************************************************************************/
struct IDirectDrawClipperImpl struct IDirectDrawClipperImpl
{ {
/* IUnknown fields */ IDirectDrawClipper IDirectDrawClipper_iface;
const IDirectDrawClipperVtbl *lpVtbl;
LONG ref; LONG ref;
struct wined3d_clipper *wineD3DClipper; struct wined3d_clipper *wineD3DClipper;
......
...@@ -3645,7 +3645,7 @@ static HRESULT WINAPI ddraw_surface7_SetClipper(IDirectDrawSurface7 *iface, IDir ...@@ -3645,7 +3645,7 @@ static HRESULT WINAPI ddraw_surface7_SetClipper(IDirectDrawSurface7 *iface, IDir
if (Clipper != NULL) if (Clipper != NULL)
IDirectDrawClipper_AddRef(Clipper); IDirectDrawClipper_AddRef(Clipper);
if(oldClipper) if(oldClipper)
IDirectDrawClipper_Release((IDirectDrawClipper *)oldClipper); IDirectDrawClipper_Release(&oldClipper->IDirectDrawClipper_iface);
hr = wined3d_surface_set_clipper(This->wined3d_surface, hr = wined3d_surface_set_clipper(This->wined3d_surface,
This->clipper ? This->clipper->wineD3DClipper : NULL); This->clipper ? This->clipper->wineD3DClipper : NULL);
......
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