ddraw: Use ddraw_from_d3d7 to make a (IDirectDrawImpl *) from a (IDirect3D7 *).

This commit is contained in:
Vincent Pelletier 2009-02-09 22:58:27 +01:00 committed by Alexandre Julliard
parent 95b8f49dfd
commit f879176b99
2 changed files with 10 additions and 3 deletions

View File

@ -1790,7 +1790,7 @@ Thunk_IDirect3DDeviceImpl_3_GetDirect3D(IDirect3DDevice3 *iface,
ret = IDirect3DDevice7_GetDirect3D((IDirect3DDevice7 *)This, &ret_ptr); ret = IDirect3DDevice7_GetDirect3D((IDirect3DDevice7 *)This, &ret_ptr);
if(ret != D3D_OK) if(ret != D3D_OK)
return ret; return ret;
*Direct3D3 = ret_ptr ? (IDirect3D3 *)&((IDirectDrawImpl *)ret_ptr)->IDirect3D3_vtbl : NULL; *Direct3D3 = ret_ptr ? (IDirect3D3 *)&ddraw_from_d3d7(ret_ptr)->IDirect3D3_vtbl : NULL;
TRACE(" returning interface %p\n", *Direct3D3); TRACE(" returning interface %p\n", *Direct3D3);
return D3D_OK; return D3D_OK;
} }
@ -1807,7 +1807,7 @@ Thunk_IDirect3DDeviceImpl_2_GetDirect3D(IDirect3DDevice2 *iface,
ret = IDirect3DDevice7_GetDirect3D((IDirect3DDevice7 *)This, &ret_ptr); ret = IDirect3DDevice7_GetDirect3D((IDirect3DDevice7 *)This, &ret_ptr);
if(ret != D3D_OK) if(ret != D3D_OK)
return ret; return ret;
*Direct3D2 = ret_ptr ? (IDirect3D2 *)&((IDirectDrawImpl *)ret_ptr)->IDirect3D2_vtbl : NULL; *Direct3D2 = ret_ptr ? (IDirect3D2 *)&ddraw_from_d3d7(ret_ptr)->IDirect3D2_vtbl : NULL;
TRACE(" returning interface %p\n", *Direct3D2); TRACE(" returning interface %p\n", *Direct3D2);
return D3D_OK; return D3D_OK;
} }
@ -1824,7 +1824,7 @@ Thunk_IDirect3DDeviceImpl_1_GetDirect3D(IDirect3DDevice *iface,
ret = IDirect3DDevice7_GetDirect3D((IDirect3DDevice7 *)This, &ret_ptr); ret = IDirect3DDevice7_GetDirect3D((IDirect3DDevice7 *)This, &ret_ptr);
if(ret != D3D_OK) if(ret != D3D_OK)
return ret; return ret;
*Direct3D = ret_ptr ? (IDirect3D *)&((IDirectDrawImpl *)ret_ptr)->IDirect3D_vtbl : NULL; *Direct3D = ret_ptr ? (IDirect3D *)&ddraw_from_d3d7(ret_ptr)->IDirect3D_vtbl : NULL;
TRACE(" returning interface %p\n", *Direct3D); TRACE(" returning interface %p\n", *Direct3D);
return D3D_OK; return D3D_OK;
} }

View File

@ -1033,6 +1033,7 @@ static void Direct3D1Test(void)
D3DVIEWPORT vp_data; D3DVIEWPORT vp_data;
D3DINSTRUCTION *instr; D3DINSTRUCTION *instr;
D3DBRANCH *branch; D3DBRANCH *branch;
IDirect3D *Direct3D_alt;
unsigned int idx = 0; unsigned int idx = 0;
static struct v_in testverts[] = { static struct v_in testverts[] = {
{0.0, 0.0, 0.0}, { 1.0, 1.0, 1.0}, {-1.0, -1.0, -1.0}, {0.0, 0.0, 0.0}, { 1.0, 1.0, 1.0}, {-1.0, -1.0, -1.0},
@ -1050,6 +1051,12 @@ static void Direct3D1Test(void)
D3DTRANSFORMDATA transformdata; D3DTRANSFORMDATA transformdata;
DWORD i = FALSE; DWORD i = FALSE;
/* Interface consistency check. */
hr = IDirect3DDevice_GetDirect3D(Direct3DDevice1, &Direct3D_alt);
ok(hr == D3D_OK, "IDirect3DDevice_GetDirect3D failed: %08x\n", hr);
if (hr == D3D_OK)
ok(Direct3D_alt == Direct3D1, "Direct3D1 struct pointer missmatch: %p != %p\n", Direct3D_alt, Direct3D1);
memset(&desc, 0, sizeof(desc)); memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc); desc.dwSize = sizeof(desc);
hr = IDirect3DExecuteBuffer_Lock(ExecuteBuffer, &desc); hr = IDirect3DExecuteBuffer_Lock(ExecuteBuffer, &desc);