Commit 9e50efd8 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

ddraw: Use unsafe_impl_from_IDirectDrawClipper for an app provided iface.

parent 588ddee7
......@@ -308,3 +308,12 @@ HRESULT ddraw_clipper_init(IDirectDrawClipperImpl *clipper)
return DD_OK;
}
IDirectDrawClipperImpl *unsafe_impl_from_IDirectDrawClipper(IDirectDrawClipper *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &ddraw_clipper_vtbl);
return impl_from_IDirectDrawClipper(iface);
}
......@@ -366,6 +366,7 @@ struct IDirectDrawClipperImpl
};
HRESULT ddraw_clipper_init(IDirectDrawClipperImpl *clipper) DECLSPEC_HIDDEN;
IDirectDrawClipperImpl *unsafe_impl_from_IDirectDrawClipper(IDirectDrawClipper *iface) DECLSPEC_HIDDEN;
/*****************************************************************************
* IDirectDrawPalette implementation structure
......
......@@ -3624,26 +3624,28 @@ static HRESULT WINAPI ddraw_surface1_GetClipper(IDirectDrawSurface *iface, IDire
* DD_OK on success
*
*****************************************************************************/
static HRESULT WINAPI ddraw_surface7_SetClipper(IDirectDrawSurface7 *iface, IDirectDrawClipper *Clipper)
static HRESULT WINAPI ddraw_surface7_SetClipper(IDirectDrawSurface7 *iface,
IDirectDrawClipper *iclipper)
{
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface7(iface);
IDirectDrawClipperImpl *clipper = unsafe_impl_from_IDirectDrawClipper(iclipper);
IDirectDrawClipperImpl *oldClipper = This->clipper;
HWND clipWindow;
HRESULT hr;
TRACE("iface %p, clipper %p.\n", iface, Clipper);
TRACE("iface %p, clipper %p.\n", iface, iclipper);
EnterCriticalSection(&ddraw_cs);
if ((IDirectDrawClipperImpl *)Clipper == This->clipper)
if (clipper == This->clipper)
{
LeaveCriticalSection(&ddraw_cs);
return DD_OK;
}
This->clipper = (IDirectDrawClipperImpl *)Clipper;
This->clipper = clipper;
if (Clipper != NULL)
IDirectDrawClipper_AddRef(Clipper);
if (clipper != NULL)
IDirectDrawClipper_AddRef(iclipper);
if(oldClipper)
IDirectDrawClipper_Release(&oldClipper->IDirectDrawClipper_iface);
......@@ -3653,8 +3655,8 @@ static HRESULT WINAPI ddraw_surface7_SetClipper(IDirectDrawSurface7 *iface, IDir
if (This->wined3d_swapchain)
{
clipWindow = NULL;
if(Clipper) {
IDirectDrawClipper_GetHWnd(Clipper, &clipWindow);
if(clipper) {
IDirectDrawClipper_GetHWnd(iclipper, &clipWindow);
}
if (clipWindow)
......
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