Commit 38982ddf authored by Ričardas Barkauskas's avatar Ričardas Barkauskas Committed by Alexandre Julliard

ddraw: Use unsafe_impl_from_IDirect3DViewport2 for application provided interfaces.

parent 25bf0e91
......@@ -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 */
......
......@@ -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);
......
......@@ -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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment