ddraw: Use unsafe_impl_from_IDirectDrawClipper for an app provided iface.
This commit is contained in:
parent
588ddee736
commit
9e50efd89f
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue