Commit 25bf0e91 authored by Ričardas Barkauskas's avatar Ričardas Barkauskas Committed by Alexandre Julliard

ddraw: Use unsafe_impl_from_IDirect3DViewport for application provided interfaces.

parent 6253d319
......@@ -470,6 +470,7 @@ struct IDirect3DViewportImpl
};
IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport3(IDirect3DViewport3 *iface) DECLSPEC_HIDDEN;
IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport(IDirect3DViewport *iface) DECLSPEC_HIDDEN;
/* Helper functions */
void viewport_activate(IDirect3DViewportImpl* This, BOOL ignore_lights) DECLSPEC_HIDDEN;
......
......@@ -712,7 +712,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_Execute(IDirect3DDevice *iface,
{
IDirect3DDeviceImpl *This = device_from_device1(iface);
IDirect3DExecuteBufferImpl *buffer = unsafe_impl_from_IDirect3DExecuteBuffer(ExecuteBuffer);
IDirect3DViewportImpl *Direct3DViewportImpl = (IDirect3DViewportImpl *)Viewport;
IDirect3DViewportImpl *Direct3DViewportImpl = unsafe_impl_from_IDirect3DViewport(Viewport);
HRESULT hr;
TRACE("iface %p, buffer %p, viewport %p, flags %#x.\n", iface, ExecuteBuffer, Viewport, Flags);
......@@ -782,7 +782,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_AddViewport(IDirect3DDevice *iface,
IDirect3DViewport *Direct3DViewport)
{
IDirect3DDeviceImpl *This = device_from_device1(iface);
IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Direct3DViewport;
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport(Direct3DViewport);
TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport);
......@@ -843,7 +843,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_DeleteViewport(IDirect3DDevice *ifac
IDirect3DViewport *Direct3DViewport)
{
IDirect3DDeviceImpl *This = device_from_device1(iface);
IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Direct3DViewport;
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport(Direct3DViewport);
TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport);
......@@ -944,7 +944,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_NextViewport(IDirect3DDevice *iface,
IDirect3DViewport *Viewport, IDirect3DViewport **lplpDirect3DViewport, DWORD Flags)
{
IDirect3DDeviceImpl *This = device_from_device1(iface);
IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Viewport;
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport(Viewport);
IDirect3DViewport3 *res;
HRESULT hr;
......
......@@ -1127,6 +1127,14 @@ IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport3(IDirect3DViewport3 *i
return CONTAINING_RECORD(iface, IDirect3DViewportImpl, IDirect3DViewport3_iface);
}
IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport(IDirect3DViewport *iface)
{
/* IDirect3DViewport and IDirect3DViewport3 use the same iface. */
if (!iface) return NULL;
assert(iface->lpVtbl == (IDirect3DViewportVtbl *)&d3d_viewport_vtbl);
return CONTAINING_RECORD(iface, IDirect3DViewportImpl, IDirect3DViewport3_iface);
}
void d3d_viewport_init(IDirect3DViewportImpl *viewport, IDirectDrawImpl *ddraw)
{
viewport->IDirect3DViewport3_iface.lpVtbl = &d3d_viewport_vtbl;
......
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