ddraw: Use unsafe_impl_from_IDirect3DViewport2 for application provided interfaces.

This commit is contained in:
Ričardas Barkauskas 2011-10-03 17:14:59 -05:00 committed by Alexandre Julliard
parent 25bf0e914c
commit 38982ddf11
3 changed files with 13 additions and 4 deletions

View File

@ -470,6 +470,7 @@ struct IDirect3DViewportImpl
};
IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport3(IDirect3DViewport3 *iface) DECLSPEC_HIDDEN;
IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport2(IDirect3DViewport2 *iface) DECLSPEC_HIDDEN;
IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport(IDirect3DViewport *iface) DECLSPEC_HIDDEN;
/* Helper functions */

View File

@ -771,7 +771,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_AddViewport(IDirect3DDevice2 *iface,
IDirect3DViewport2 *Direct3DViewport2)
{
IDirect3DDeviceImpl *This = device_from_device2(iface);
IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Direct3DViewport2;
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport2(Direct3DViewport2);
TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport2);
@ -832,7 +832,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_DeleteViewport(IDirect3DDevice2 *ifa
IDirect3DViewport2 *Direct3DViewport2)
{
IDirect3DDeviceImpl *This = device_from_device2(iface);
IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Direct3DViewport2;
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport2(Direct3DViewport2);
TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport2);
@ -927,7 +927,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_NextViewport(IDirect3DDevice2 *iface
IDirect3DViewport2 *Viewport2, IDirect3DViewport2 **lplpDirect3DViewport2, DWORD Flags)
{
IDirect3DDeviceImpl *This = device_from_device2(iface);
IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Viewport2;
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport2(Viewport2);
IDirect3DViewport3 *res;
HRESULT hr;
@ -1749,7 +1749,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_SetCurrentViewport(IDirect3DDevice2
IDirect3DViewport2 *Direct3DViewport2)
{
IDirect3DDeviceImpl *This = device_from_device2(iface);
IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Direct3DViewport2;
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport2(Direct3DViewport2);
TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport2);

View File

@ -1127,6 +1127,14 @@ IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport3(IDirect3DViewport3 *i
return CONTAINING_RECORD(iface, IDirect3DViewportImpl, IDirect3DViewport3_iface);
}
IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport2(IDirect3DViewport2 *iface)
{
/* IDirect3DViewport and IDirect3DViewport3 use the same iface. */
if (!iface) return NULL;
assert(iface->lpVtbl == (IDirect3DViewport2Vtbl *)&d3d_viewport_vtbl);
return CONTAINING_RECORD(iface, IDirect3DViewportImpl, IDirect3DViewport3_iface);
}
IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport(IDirect3DViewport *iface)
{
/* IDirect3DViewport and IDirect3DViewport3 use the same iface. */