ddraw: Use unsafe_impl_from_IDirectDrawSurface() for application provided interfaces.

This commit is contained in:
Ričardas Barkauskas 2011-06-09 17:40:19 +03:00 committed by Alexandre Julliard
parent a8ee7c5e00
commit 27063ffeaa
4 changed files with 13 additions and 5 deletions

View File

@ -4266,7 +4266,7 @@ static HRESULT WINAPI ddraw3_DuplicateSurface(IDirectDraw3 *iface, IDirectDrawSu
IDirectDrawSurface **dst) IDirectDrawSurface **dst)
{ {
IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); IDirectDrawImpl *This = impl_from_IDirectDraw3(iface);
IDirectDrawSurfaceImpl *src_impl = unsafe_impl_from_IDirectDrawSurface3((IDirectDrawSurface3 *)src); IDirectDrawSurfaceImpl *src_impl = unsafe_impl_from_IDirectDrawSurface(src);
IDirectDrawSurface7 *dst7; IDirectDrawSurface7 *dst7;
IDirectDrawSurfaceImpl *dst_impl; IDirectDrawSurfaceImpl *dst_impl;
HRESULT hr; HRESULT hr;
@ -4286,7 +4286,7 @@ static HRESULT WINAPI ddraw2_DuplicateSurface(IDirectDraw2 *iface,
IDirectDrawSurface *src, IDirectDrawSurface **dst) IDirectDrawSurface *src, IDirectDrawSurface **dst)
{ {
IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
IDirectDrawSurfaceImpl *src_impl = unsafe_impl_from_IDirectDrawSurface3((IDirectDrawSurface3 *)src); IDirectDrawSurfaceImpl *src_impl = unsafe_impl_from_IDirectDrawSurface(src);
IDirectDrawSurface7 *dst7; IDirectDrawSurface7 *dst7;
IDirectDrawSurfaceImpl *dst_impl; IDirectDrawSurfaceImpl *dst_impl;
HRESULT hr; HRESULT hr;
@ -4306,7 +4306,7 @@ static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface, IDirectDrawSur
IDirectDrawSurface **dst) IDirectDrawSurface **dst)
{ {
IDirectDrawImpl *This = impl_from_IDirectDraw(iface); IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
IDirectDrawSurfaceImpl *src_impl = unsafe_impl_from_IDirectDrawSurface3((IDirectDrawSurface3 *)src); IDirectDrawSurfaceImpl *src_impl = unsafe_impl_from_IDirectDrawSurface(src);
IDirectDrawSurface7 *dst7; IDirectDrawSurface7 *dst7;
IDirectDrawSurfaceImpl *dst_impl; IDirectDrawSurfaceImpl *dst_impl;
HRESULT hr; HRESULT hr;
@ -4906,7 +4906,7 @@ static HRESULT WINAPI d3d2_CreateDevice(IDirect3D2 *iface, REFCLSID riid,
IDirectDrawSurface *surface, IDirect3DDevice2 **device) IDirectDrawSurface *surface, IDirect3DDevice2 **device)
{ {
IDirectDrawImpl *This = impl_from_IDirect3D2(iface); IDirectDrawImpl *This = impl_from_IDirect3D2(iface);
IDirectDrawSurfaceImpl *surface_impl = unsafe_impl_from_IDirectDrawSurface3((IDirectDrawSurface3 *)surface); IDirectDrawSurfaceImpl *surface_impl = unsafe_impl_from_IDirectDrawSurface(surface);
HRESULT hr; HRESULT hr;
TRACE("iface %p, riid %s, surface %p, device %p.\n", TRACE("iface %p, riid %s, surface %p, device %p.\n",

View File

@ -242,6 +242,7 @@ static inline IDirectDrawSurfaceImpl *impl_from_IDirectDrawSurface7(IDirectDrawS
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface7_iface); return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface7_iface);
} }
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface(IDirectDrawSurface *iface) DECLSPEC_HIDDEN;
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface2(IDirectDrawSurface2 *iface) DECLSPEC_HIDDEN; IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface2(IDirectDrawSurface2 *iface) DECLSPEC_HIDDEN;
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface3(IDirectDrawSurface3 *iface) DECLSPEC_HIDDEN; IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface3(IDirectDrawSurface3 *iface) DECLSPEC_HIDDEN;
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface4(IDirectDrawSurface4 *iface) DECLSPEC_HIDDEN; IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface4(IDirectDrawSurface4 *iface) DECLSPEC_HIDDEN;

View File

@ -1901,7 +1901,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_SetRenderTarget(IDirect3DDevice2 *if
IDirectDrawSurface *NewRenderTarget, DWORD Flags) IDirectDrawSurface *NewRenderTarget, DWORD Flags)
{ {
IDirect3DDeviceImpl *This = device_from_device2(iface); IDirect3DDeviceImpl *This = device_from_device2(iface);
IDirectDrawSurfaceImpl *Target = unsafe_impl_from_IDirectDrawSurface3((IDirectDrawSurface3 *)NewRenderTarget); IDirectDrawSurfaceImpl *Target = unsafe_impl_from_IDirectDrawSurface(NewRenderTarget);
TRACE("iface %p, target %p, flags %#x.\n", iface, NewRenderTarget, Flags); TRACE("iface %p, target %p, flags %#x.\n", iface, NewRenderTarget, Flags);

View File

@ -4421,6 +4421,13 @@ IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface2(IDirectDrawSurface2
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface2_iface); return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface2_iface);
} }
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface(IDirectDrawSurface *iface)
{
if (!iface) return NULL;
assert(iface->lpVtbl == (struct IDirectDrawSurfaceVtbl *)&ddraw_surface3_vtbl);
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface3_iface);
}
static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *parent) static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *parent)
{ {
IDirectDrawSurfaceImpl *surface = parent; IDirectDrawSurfaceImpl *surface = parent;