mirror of
https://github.com/reactos/wine.git
synced 2024-11-26 05:00:30 +00:00
ddraw: Use unsafe_impl_from_IDirect3DDevice for application provided interfaces.
This commit is contained in:
parent
4dbc0690ef
commit
d19e416dee
@ -340,6 +340,8 @@ static inline IDirect3DDeviceImpl *device_from_device3(IDirect3DDevice3 *iface)
|
||||
return (IDirect3DDeviceImpl *)((char*)iface - FIELD_OFFSET(IDirect3DDeviceImpl, IDirect3DDevice3_vtbl));
|
||||
}
|
||||
|
||||
IDirect3DDeviceImpl *unsafe_impl_from_IDirect3DDevice(IDirect3DDevice *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectDrawClipper implementation structure
|
||||
*****************************************************************************/
|
||||
|
@ -6732,6 +6732,13 @@ static const struct IDirect3DDeviceVtbl d3d_device1_vtbl =
|
||||
IDirect3DDeviceImpl_1_GetDirect3D
|
||||
};
|
||||
|
||||
IDirect3DDeviceImpl *unsafe_impl_from_IDirect3DDevice(IDirect3DDevice *iface)
|
||||
{
|
||||
if (!iface) return NULL;
|
||||
assert(iface->lpVtbl == &d3d_device1_vtbl);
|
||||
return CONTAINING_RECORD(iface, IDirect3DDeviceImpl, IDirect3DDevice_vtbl);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirect3DDeviceImpl_UpdateDepthStencil
|
||||
*
|
||||
|
@ -335,14 +335,15 @@ static HRESULT WINAPI IDirect3DMaterialImpl_2_GetHandle(IDirect3DMaterial2 *ifac
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3DMaterialImpl_1_GetHandle(IDirect3DMaterial *iface,
|
||||
IDirect3DDevice *lpDirect3DDevice, D3DMATERIALHANDLE *lpHandle)
|
||||
IDirect3DDevice *device, D3DMATERIALHANDLE *handle)
|
||||
{
|
||||
IDirect3DMaterialImpl *This = impl_from_IDirect3DMaterial(iface);
|
||||
IDirect3DDeviceImpl *device_impl = unsafe_impl_from_IDirect3DDevice(device);
|
||||
|
||||
TRACE("iface %p, device %p, handle %p.\n", iface, lpDirect3DDevice, lpHandle);
|
||||
TRACE("iface %p, device %p, handle %p.\n", iface, device, handle);
|
||||
|
||||
return IDirect3DMaterial3_GetHandle(&This->IDirect3DMaterial3_iface, lpDirect3DDevice ?
|
||||
(IDirect3DDevice3 *)&device_from_device1(lpDirect3DDevice)->IDirect3DDevice3_vtbl : NULL, lpHandle);
|
||||
return IDirect3DMaterial3_GetHandle(&This->IDirect3DMaterial3_iface, device_impl ?
|
||||
(IDirect3DDevice3 *)&device_impl->IDirect3DDevice3_vtbl : NULL, handle);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3DMaterialImpl_2_QueryInterface(IDirect3DMaterial2 *iface, REFIID riid,
|
||||
|
@ -4551,11 +4551,12 @@ static HRESULT WINAPI d3d_texture1_GetHandle(IDirect3DTexture *iface,
|
||||
IDirect3DDevice *device, D3DTEXTUREHANDLE *handle)
|
||||
{
|
||||
IDirectDrawSurfaceImpl *This = impl_from_IDirect3DTexture(iface);
|
||||
IDirect3DDevice2 *device2 = (IDirect3DDevice2 *)&device_from_device1(device)->IDirect3DDevice2_vtbl;
|
||||
IDirect3DDeviceImpl *device_impl = unsafe_impl_from_IDirect3DDevice(device);
|
||||
|
||||
TRACE("iface %p, device %p, handle %p.\n", iface, device, handle);
|
||||
|
||||
return d3d_texture2_GetHandle(&This->IDirect3DTexture2_iface, device2, handle);
|
||||
return d3d_texture2_GetHandle(&This->IDirect3DTexture2_iface,
|
||||
device_impl ? (IDirect3DDevice2 *)&device_impl->IDirect3DDevice2_vtbl : NULL, handle);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user