Commit 7dc08745 authored by Ričardas Barkauskas's avatar Ričardas Barkauskas Committed by Alexandre Julliard

ddraw: Use impl_from_IDirect3DDevice7 for application provided interfaces.

parent 31cf68dd
......@@ -4352,7 +4352,7 @@ static HRESULT WINAPI d3d3_CreateDevice(IDirect3D3 *iface, REFCLSID riid,
surface_impl ? &surface_impl->IDirectDrawSurface7_iface : NULL, device ? &device7 : NULL);
if (SUCCEEDED(hr))
{
device_impl = (IDirect3DDeviceImpl *)device7;
device_impl = impl_from_IDirect3DDevice7(device7);
*device = &device_impl->IDirect3DDevice3_iface;
}
......@@ -4375,7 +4375,7 @@ static HRESULT WINAPI d3d2_CreateDevice(IDirect3D2 *iface, REFCLSID riid,
surface_impl ? &surface_impl->IDirectDrawSurface7_iface : NULL, device ? &device7 : NULL);
if (SUCCEEDED(hr))
{
device_impl = (IDirect3DDeviceImpl *)device7;
device_impl = impl_from_IDirect3DDevice7(device7);
*device = &device_impl->IDirect3DDevice2_iface;
}
......
......@@ -340,6 +340,11 @@ static inline IDirect3DDeviceImpl *impl_from_IDirect3DDevice3(IDirect3DDevice3 *
return CONTAINING_RECORD(iface, IDirect3DDeviceImpl, IDirect3DDevice3_iface);
}
static inline IDirect3DDeviceImpl *impl_from_IDirect3DDevice7(IDirect3DDevice7 *iface)
{
return CONTAINING_RECORD(iface, IDirect3DDeviceImpl, lpVtbl);
}
IDirect3DDeviceImpl *unsafe_impl_from_IDirect3DDevice(IDirect3DDevice *iface) DECLSPEC_HIDDEN;
IDirect3DDeviceImpl *unsafe_impl_from_IDirect3DDevice2(IDirect3DDevice2 *iface) DECLSPEC_HIDDEN;
IDirect3DDeviceImpl *unsafe_impl_from_IDirect3DDevice3(IDirect3DDevice3 *iface) DECLSPEC_HIDDEN;
......
......@@ -127,6 +127,7 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface,
IsEqualGUID(riid, &IID_IDirect3DRGBDevice) )
{
IDirect3DDevice7 *d3d;
IDirect3DDeviceImpl *device_impl;
/* Call into IDirect3D7 for creation */
IDirect3D7_CreateDevice(&This->ddraw->IDirect3D7_iface, riid, &This->IDirectDrawSurface7_iface,
......@@ -134,7 +135,8 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface,
if (d3d)
{
*obj = &((IDirect3DDeviceImpl *)d3d)->IDirect3DDevice_iface;
device_impl = impl_from_IDirect3DDevice7(d3d);
*obj = &device_impl->IDirect3DDevice_iface;
TRACE("(%p) Returning IDirect3DDevice interface at %p\n", This, *obj);
return S_OK;
}
......
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