ddraw: Use unsafe_impl_from_IDirectDrawSurface4.

This commit is contained in:
Ričardas Barkauskas 2011-06-06 14:08:23 +03:00 committed by Alexandre Julliard
parent 2f02bbb41f
commit 4582562f55
4 changed files with 11 additions and 3 deletions

View File

@ -4243,7 +4243,7 @@ static HRESULT WINAPI ddraw4_DuplicateSurface(IDirectDraw4 *iface, IDirectDrawSu
IDirectDrawSurface4 **dst)
{
IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
IDirectDrawSurfaceImpl *src_impl = (IDirectDrawSurfaceImpl *)src;
IDirectDrawSurfaceImpl *src_impl = unsafe_impl_from_IDirectDrawSurface4(src);
IDirectDrawSurface7 *dst7;
IDirectDrawSurfaceImpl *dst_impl;
HRESULT hr;
@ -4879,7 +4879,7 @@ static HRESULT WINAPI d3d3_CreateDevice(IDirect3D3 *iface, REFCLSID riid,
IDirectDrawSurface4 *surface, IDirect3DDevice3 **device, IUnknown *outer_unknown)
{
IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
IDirectDrawSurfaceImpl *surface_impl = (IDirectDrawSurfaceImpl *)surface;
IDirectDrawSurfaceImpl *surface_impl = unsafe_impl_from_IDirectDrawSurface4(surface);
HRESULT hr;
TRACE("iface %p, riid %s, surface %p, device %p, outer_unknown %p.\n",

View File

@ -231,6 +231,7 @@ static inline IDirectDrawSurfaceImpl *impl_from_IDirectDrawSurface7(IDirectDrawS
}
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface3(IDirectDrawSurface3 *iface) DECLSPEC_HIDDEN;
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface4(IDirectDrawSurface4 *iface) DECLSPEC_HIDDEN;
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface) DECLSPEC_HIDDEN;
/* Get the number of bytes per pixel for a given surface */

View File

@ -1889,7 +1889,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_3_SetRenderTarget(IDirect3DDevice3 *if
IDirectDrawSurface4 *NewRenderTarget, DWORD Flags)
{
IDirect3DDeviceImpl *This = device_from_device3(iface);
IDirectDrawSurfaceImpl *Target = (IDirectDrawSurfaceImpl *)NewRenderTarget;
IDirectDrawSurfaceImpl *Target = unsafe_impl_from_IDirectDrawSurface4(NewRenderTarget);
TRACE("iface %p, target %p, flags %#x.\n", iface, NewRenderTarget, Flags);

View File

@ -3465,6 +3465,13 @@ IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface7(IDirectDrawSurface7
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface7_iface);
}
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface4(IDirectDrawSurface4 *iface)
{
if (!iface) return NULL;
assert(iface->lpVtbl == (struct IDirectDrawSurface4Vtbl *)&ddraw_surface7_vtbl);
return CONTAINING_RECORD(iface, IDirectDrawSurfaceImpl, IDirectDrawSurface7_iface);
}
IDirectDrawSurfaceImpl *unsafe_impl_from_IDirectDrawSurface3(IDirectDrawSurface3 *iface)
{
if (!iface) return NULL;