Commit 9a0c885e authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Get rid of ICOM_INTERFACE.

parent ad171b14
......@@ -62,14 +62,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
static HRESULT WINAPI IDirectDrawClipperImpl_QueryInterface(
LPDIRECTDRAWCLIPPER iface, REFIID riid, LPVOID* ppvObj
) {
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
if (IsEqualGUID(&IID_IUnknown, riid)
|| IsEqualGUID(&IID_IDirectDrawClipper, riid))
{
*ppvObj = ICOM_INTERFACE(This, IDirectDrawClipper);
InterlockedIncrement(&This->ref);
return S_OK;
IUnknown_AddRef(iface);
*ppvObj = iface;
return S_OK;
}
else
{
......
......@@ -38,11 +38,7 @@
#define ICOM_THIS_FROM(impltype, ifacename, ifaceptr) \
impltype* This = ICOM_OBJECT(impltype, ifacename, ifaceptr)
/* Given an object and interface name, returns a pointer to that interface. */
#define ICOM_INTERFACE(implobj, iface) \
((iface *)(implobj == NULL ? NULL :&((implobj)->ICOM_VFIELD_MULTI_NAME(iface))))
#define COM_INTERFACE_CAST(impltype, ifnamefrom, ifnameto, ifaceptr) \
ICOM_INTERFACE(ICOM_OBJECT(impltype, ifnamefrom, ifaceptr), ifnameto)
#define COM_INTERFACE_CAST(impltype, ifnamefrom, ifnameto, ifaceptr) \
((ifaceptr) ? (ifnameto *)&(((impltype *)((char *)(ifaceptr) \
- ICOM_VFIELD_OFFSET(impltype, ifnamefrom)))->ICOM_VFIELD_MULTI_NAME(ifnameto)) : NULL)
#endif /* _DDCOMIMPL_H_ */
......@@ -111,12 +111,12 @@ IDirectDrawImpl_QueryInterface(IDirectDraw7 *iface,
if ( IsEqualGUID( &IID_IUnknown, refiid ) ||
IsEqualGUID( &IID_IDirectDraw7, refiid ) )
{
*obj = ICOM_INTERFACE(This, IDirectDraw7);
*obj = &This->IDirectDraw7_vtbl;
TRACE("(%p) Returning IDirectDraw7 interface at %p\n", This, *obj);
}
else if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) )
{
*obj = ICOM_INTERFACE(This, IDirectDraw4);
*obj = &This->IDirectDraw4_vtbl;
TRACE("(%p) Returning IDirectDraw4 interface at %p\n", This, *obj);
}
else if ( IsEqualGUID( &IID_IDirectDraw3, refiid ) )
......@@ -129,12 +129,12 @@ IDirectDrawImpl_QueryInterface(IDirectDraw7 *iface,
}
else if ( IsEqualGUID( &IID_IDirectDraw2, refiid ) )
{
*obj = ICOM_INTERFACE(This, IDirectDraw2);
*obj = &This->IDirectDraw2_vtbl;
TRACE("(%p) Returning IDirectDraw2 interface at %p\n", This, *obj);
}
else if ( IsEqualGUID( &IID_IDirectDraw, refiid ) )
{
*obj = ICOM_INTERFACE(This, IDirectDraw);
*obj = &This->IDirectDraw_vtbl;
TRACE("(%p) Returning IDirectDraw interface at %p\n", This, *obj);
}
......@@ -173,25 +173,25 @@ IDirectDrawImpl_QueryInterface(IDirectDraw7 *iface,
if ( IsEqualGUID( &IID_IDirect3D , refiid ) )
{
This->d3dversion = 1;
*obj = ICOM_INTERFACE(This, IDirect3D);
*obj = &This->IDirect3D_vtbl;
TRACE(" returning Direct3D interface at %p.\n", *obj);
}
else if ( IsEqualGUID( &IID_IDirect3D2 , refiid ) )
{
This->d3dversion = 2;
*obj = ICOM_INTERFACE(This, IDirect3D2);
*obj = &This->IDirect3D2_vtbl;
TRACE(" returning Direct3D2 interface at %p.\n", *obj);
}
else if ( IsEqualGUID( &IID_IDirect3D3 , refiid ) )
{
This->d3dversion = 3;
*obj = ICOM_INTERFACE(This, IDirect3D3);
*obj = &This->IDirect3D3_vtbl;
TRACE(" returning Direct3D3 interface at %p.\n", *obj);
}
else if(IsEqualGUID( &IID_IDirect3D7 , refiid ))
{
This->d3dversion = 7;
*obj = ICOM_INTERFACE(This, IDirect3D7);
*obj = &This->IDirect3D7_vtbl;
TRACE(" returning Direct3D7 interface at %p.\n", *obj);
}
}
......@@ -258,9 +258,7 @@ void
IDirectDrawImpl_Destroy(IDirectDrawImpl *This)
{
/* Clear the cooplevel to restore window and display mode */
IDirectDraw7_SetCooperativeLevel(ICOM_INTERFACE(This, IDirectDraw7),
NULL,
DDSCL_NORMAL);
IDirectDraw7_SetCooperativeLevel((IDirectDraw7 *)This, NULL, DDSCL_NORMAL);
/* Destroy the device window if we created one */
if(This->devicewindow != 0)
......@@ -667,12 +665,8 @@ IDirectDrawImpl_RestoreDisplayMode(IDirectDraw7 *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw7, iface);
TRACE("(%p)\n", This);
return IDirectDrawImpl_SetDisplayModeNoOverride(ICOM_INTERFACE(This, IDirectDraw7),
This->orig_width,
This->orig_height,
This->orig_bpp,
0,
0);
return IDirectDrawImpl_SetDisplayModeNoOverride(iface,
This->orig_width, This->orig_height, This->orig_bpp, 0, 0);
}
/*****************************************************************************
......@@ -1817,11 +1811,7 @@ IDirectDrawImpl_RecreateAllSurfaces(IDirectDrawImpl *This)
memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc);
return IDirectDraw7_EnumSurfaces(ICOM_INTERFACE(This, IDirectDraw7),
0,
&desc,
This,
IDirectDrawImpl_RecreateSurfacesCallback);
return IDirectDraw7_EnumSurfaces((IDirectDraw7 *)This, 0, &desc, This, IDirectDrawImpl_RecreateSurfacesCallback);
}
ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) {
......@@ -2037,13 +2027,13 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
}
parImpl->ref = 1;
parImpl->IParent_vtbl = &IParent_Vtbl;
Parent = (IUnknown *) ICOM_INTERFACE(parImpl, IParent);
Parent = (IUnknown *)parImpl;
TRACE("Using IParent interface %p as parent\n", parImpl);
}
else
{
/* Use the surface as parent */
Parent = (IUnknown *) ICOM_INTERFACE(*ppSurf, IDirectDrawSurface7);
Parent = (IUnknown *)*ppSurf;
TRACE("Using Surface interface %p as parent\n", *ppSurf);
}
......@@ -2173,7 +2163,7 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
if(hr != WINED3D_OK)
{
/* No need for a trace here, wined3d does that for us */
IDirectDrawSurface7_Release(ICOM_INTERFACE((*ppSurf), IDirectDrawSurface7));
IDirectDrawSurface7_Release((IDirectDrawSurface7 *)*ppSurf);
return hr;
}
}
......@@ -2597,7 +2587,7 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
}
object->is_complex_root = TRUE;
*Surf = ICOM_INTERFACE(object, IDirectDrawSurface7);
*Surf = (IDirectDrawSurface7 *)object;
/* Create Additional surfaces if necessary
* This applies to Primary surfaces which have a back buffer count
......@@ -2637,7 +2627,7 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
if(hr != DD_OK)
{
/* This destroys and possibly created surfaces too */
IDirectDrawSurface_Release( ICOM_INTERFACE(object, IDirectDrawSurface7) );
IDirectDrawSurface_Release((IDirectDrawSurface7 *)object);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
......@@ -2739,13 +2729,13 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
{
hr = IWineD3DDevice_CreateCubeTexture(This->wineD3DDevice, DDSD->dwWidth /* Edgelength */,
levels, 0 /* usage */, Format, Pool, (IWineD3DCubeTexture **)&object->wineD3DTexture,
0 /* SharedHandle */, (IUnknown *)ICOM_INTERFACE(object, IDirectDrawSurface7));
0 /* SharedHandle */, (IUnknown *)object);
}
else
{
hr = IWineD3DDevice_CreateTexture(This->wineD3DDevice, DDSD->dwWidth, DDSD->dwHeight, levels,
0 /* usage */, Format, Pool, (IWineD3DTexture **) &object->wineD3DTexture,
0 /* SharedHandle */, (IUnknown *)ICOM_INTERFACE(object, IDirectDrawSurface7));
0 /* SharedHandle */, (IUnknown *)object);
}
This->tex_root = NULL;
}
......@@ -2925,8 +2915,8 @@ IDirectDrawImpl_EnumSurfaces(IDirectDraw7 *iface,
if (all || (nomatch != IDirectDrawImpl_DDSD_Match(DDSD, &surf->surface_desc)))
{
desc = surf->surface_desc;
IDirectDrawSurface7_AddRef(ICOM_INTERFACE(surf, IDirectDrawSurface7));
if(Callback( ICOM_INTERFACE(surf, IDirectDrawSurface7), &desc, Context) != DDENUMRET_OK)
IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)surf);
if (Callback((IDirectDrawSurface7 *)surf, &desc, Context) != DDENUMRET_OK)
{
LeaveCriticalSection(&ddraw_cs);
return DD_OK;
......@@ -3229,7 +3219,8 @@ IDirectDrawImpl_CreatePalette(IDirectDraw7 *iface,
object->ref = 1;
object->ddraw_owner = This;
hr = IWineD3DDevice_CreatePalette(This->wineD3DDevice, Flags, ColorTable, &object->wineD3DPalette, (IUnknown *) ICOM_INTERFACE(object, IDirectDrawPalette) );
hr = IWineD3DDevice_CreatePalette(This->wineD3DDevice, Flags,
ColorTable, &object->wineD3DPalette, (IUnknown *)object);
if(hr != DD_OK)
{
HeapFree(GetProcessHeap(), 0, object);
......@@ -3239,7 +3230,7 @@ IDirectDrawImpl_CreatePalette(IDirectDraw7 *iface,
IDirectDraw7_AddRef(iface);
object->ifaceToRelease = (IUnknown *) iface;
*Palette = ICOM_INTERFACE(object, IDirectDrawPalette);
*Palette = (IDirectDrawPalette *)object;
LeaveCriticalSection(&ddraw_cs);
return DD_OK;
}
......@@ -3368,10 +3359,7 @@ IDirectDrawImpl_FindDecl(IDirectDrawImpl *This,
}
TRACE("not found. Creating and inserting at position %d.\n", low);
hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(This->wineD3DDevice,
&pDecl,
(IUnknown *) ICOM_INTERFACE(This, IDirectDraw7),
fvf);
hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(This->wineD3DDevice, &pDecl, (IUnknown *)This, fvf);
if (hr != S_OK) return NULL;
if(This->declArraySize == This->numConvertedDecls) {
......@@ -3467,8 +3455,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
if (!surf)
{
IDirectDrawSurface7 *attached;
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(This->tex_root, IDirectDrawSurface7),
&searchcaps, &attached);
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)This->tex_root, &searchcaps, &attached);
surf = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, attached);
IDirectDrawSurface7_Release(attached);
}
......@@ -3478,7 +3465,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
while (i < level)
{
IDirectDrawSurface7 *attached;
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(surf, IDirectDrawSurface7), &searchcaps, &attached);
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)surf, &searchcaps, &attached);
if(!attached) ERR("Surface not found\n");
surf = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, attached);
IDirectDrawSurface7_Release(attached);
......@@ -3507,8 +3494,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
if (d3d_surface->isRenderTarget)
{
IDirectDrawSurface7_EnumAttachedSurfaces(ICOM_INTERFACE(d3d_surface, IDirectDrawSurface7),
&target, findRenderTarget);
IDirectDrawSurface7_EnumAttachedSurfaces((IDirectDrawSurface7 *)d3d_surface, &target, findRenderTarget);
}
else
{
......@@ -3612,7 +3598,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
object->ref = 1;
hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters,
swapchain, (IUnknown *)ICOM_INTERFACE(object, IParent), This->ImplType);
swapchain, (IUnknown *)object, This->ImplType);
if (FAILED(hr))
{
FIXME("(%p) CreateSwapChain failed, returning %#x\n", iface, hr);
......
......@@ -1126,7 +1126,7 @@ IDirectDrawImpl_Initialize(LPDIRECTDRAW iface, LPGUID pGUID)
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw, iface);
HRESULT ret_value;
ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID);
ret_value = IDirectDraw7_Initialize((IDirectDraw7 *)This, pGUID);
return ret_value;
}
......@@ -1137,7 +1137,7 @@ IDirectDraw2Impl_Initialize(LPDIRECTDRAW2 iface, LPGUID pGUID)
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw2, iface);
HRESULT ret_value;
ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID);
ret_value = IDirectDraw7_Initialize((IDirectDraw7 *)This, pGUID);
return ret_value;
}
......@@ -1148,7 +1148,7 @@ IDirectDraw3Impl_Initialize(LPDIRECTDRAW3 iface, LPGUID pGUID)
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw3, iface);
HRESULT ret_value;
ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID);
ret_value = IDirectDraw7_Initialize((IDirectDraw7 *)This, pGUID);
return ret_value;
}
......@@ -1159,7 +1159,7 @@ IDirectDraw4Impl_Initialize(LPDIRECTDRAW4 iface, LPGUID pGUID)
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw4, iface);
HRESULT ret_value;
ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID);
ret_value = IDirectDraw7_Initialize((IDirectDraw7 *)This, pGUID);
return ret_value;
}
......
......@@ -131,69 +131,69 @@ IDirect3DDeviceImpl_7_QueryInterface(IDirect3DDevice7 *iface,
if ( IsEqualGUID( &IID_IUnknown, refiid ) )
{
*obj = ICOM_INTERFACE(This, IDirect3DDevice7);
*obj = iface;
}
/* Check DirectDraw Interfacs */
else if( IsEqualGUID( &IID_IDirectDraw7, refiid ) )
{
*obj = ICOM_INTERFACE(This->ddraw, IDirectDraw7);
*obj = This->ddraw;
TRACE("(%p) Returning IDirectDraw7 interface at %p\n", This, *obj);
}
else if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) )
{
*obj = ICOM_INTERFACE(This->ddraw, IDirectDraw4);
*obj = &This->ddraw->IDirectDraw4_vtbl;
TRACE("(%p) Returning IDirectDraw4 interface at %p\n", This, *obj);
}
else if ( IsEqualGUID( &IID_IDirectDraw2, refiid ) )
{
*obj = ICOM_INTERFACE(This->ddraw, IDirectDraw2);
*obj = &This->ddraw->IDirectDraw2_vtbl;
TRACE("(%p) Returning IDirectDraw2 interface at %p\n", This, *obj);
}
else if( IsEqualGUID( &IID_IDirectDraw, refiid ) )
{
*obj = ICOM_INTERFACE(This->ddraw, IDirectDraw);
*obj = &This->ddraw->IDirectDraw_vtbl;
TRACE("(%p) Returning IDirectDraw interface at %p\n", This, *obj);
}
/* Direct3D */
else if ( IsEqualGUID( &IID_IDirect3D , refiid ) )
{
*obj = ICOM_INTERFACE(This->ddraw, IDirect3D);
*obj = &This->ddraw->IDirect3D_vtbl;
TRACE("(%p) Returning IDirect3D interface at %p\n", This, *obj);
}
else if ( IsEqualGUID( &IID_IDirect3D2 , refiid ) )
{
*obj = ICOM_INTERFACE(This->ddraw, IDirect3D2);
*obj = &This->ddraw->IDirect3D2_vtbl;
TRACE("(%p) Returning IDirect3D2 interface at %p\n", This, *obj);
}
else if ( IsEqualGUID( &IID_IDirect3D3 , refiid ) )
{
*obj = ICOM_INTERFACE(This->ddraw, IDirect3D3);
*obj = &This->ddraw->IDirect3D3_vtbl;
TRACE("(%p) Returning IDirect3D3 interface at %p\n", This, *obj);
}
else if ( IsEqualGUID( &IID_IDirect3D7 , refiid ) )
{
*obj = ICOM_INTERFACE(This->ddraw, IDirect3D7);
*obj = &This->ddraw->IDirect3D7_vtbl;
TRACE("(%p) Returning IDirect3D7 interface at %p\n", This, *obj);
}
/* Direct3DDevice */
else if ( IsEqualGUID( &IID_IDirect3DDevice , refiid ) )
{
*obj = ICOM_INTERFACE(This, IDirect3DDevice);
*obj = &This->IDirect3DDevice_vtbl;
TRACE("(%p) Returning IDirect3DDevice interface at %p\n", This, *obj);
}
else if ( IsEqualGUID( &IID_IDirect3DDevice2 , refiid ) ) {
*obj = ICOM_INTERFACE(This, IDirect3DDevice2);
*obj = &This->IDirect3DDevice2_vtbl;
TRACE("(%p) Returning IDirect3DDevice2 interface at %p\n", This, *obj);
}
else if ( IsEqualGUID( &IID_IDirect3DDevice3 , refiid ) ) {
*obj = ICOM_INTERFACE(This, IDirect3DDevice3);
*obj = &This->IDirect3DDevice3_vtbl;
TRACE("(%p) Returning IDirect3DDevice3 interface at %p\n", This, *obj);
}
else if ( IsEqualGUID( &IID_IDirect3DDevice7 , refiid ) ) {
*obj = ICOM_INTERFACE(This, IDirect3DDevice7);
*obj = This;
TRACE("(%p) Returning IDirect3DDevice7 interface at %p\n", This, *obj);
}
......@@ -216,9 +216,7 @@ Thunk_IDirect3DDeviceImpl_3_QueryInterface(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%s,%p) thunking to IDirect3DDevice7 interface.\n", This, debugstr_guid(riid), obj);
return IDirect3DDevice7_QueryInterface(ICOM_INTERFACE(This, IDirect3DDevice7),
riid,
obj);
return IDirect3DDevice7_QueryInterface((IDirect3DDevice7 *)This, riid, obj);
}
static HRESULT WINAPI
......@@ -228,9 +226,7 @@ Thunk_IDirect3DDeviceImpl_2_QueryInterface(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%s,%p) thunking to IDirect3DDevice7 interface.\n", This, debugstr_guid(riid), obj);
return IDirect3DDevice7_QueryInterface(ICOM_INTERFACE(This, IDirect3DDevice7),
riid,
obj);
return IDirect3DDevice7_QueryInterface((IDirect3DDevice7 *)This, riid, obj);
}
static HRESULT WINAPI
......@@ -240,9 +236,7 @@ Thunk_IDirect3DDeviceImpl_1_QueryInterface(IDirect3DDevice *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
TRACE_(ddraw_thunk)("(%p)->(%s,%p) thunking to IDirect3DDevice7 interface.\n", This, debugstr_guid(riid), obp);
return IDirect3DDevice7_QueryInterface(ICOM_INTERFACE(This, IDirect3DDevice7),
riid,
obp);
return IDirect3DDevice7_QueryInterface((IDirect3DDevice7 *)This, riid, obp);
}
/*****************************************************************************
......@@ -273,7 +267,7 @@ Thunk_IDirect3DDeviceImpl_3_AddRef(IDirect3DDevice3 *iface)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DDevice7 interface.\n", This);
return IDirect3DDevice7_AddRef(ICOM_INTERFACE(This, IDirect3DDevice7));
return IDirect3DDevice7_AddRef((IDirect3DDevice7 *)This);
}
static ULONG WINAPI
......@@ -281,7 +275,7 @@ Thunk_IDirect3DDeviceImpl_2_AddRef(IDirect3DDevice2 *iface)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DDevice7 interface.\n", This);
return IDirect3DDevice7_AddRef(ICOM_INTERFACE(This, IDirect3DDevice7));
return IDirect3DDevice7_AddRef((IDirect3DDevice7 *)This);
}
static ULONG WINAPI
......@@ -399,8 +393,7 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
{
/* No fixme here because this might happen because of sloppy apps */
WARN("Leftover matrix handle %d, deleting\n", i + 1);
IDirect3DDevice_DeleteMatrix(ICOM_INTERFACE(This, IDirect3DDevice),
i + 1);
IDirect3DDevice_DeleteMatrix((IDirect3DDevice *)&This->IDirect3DDevice_vtbl, i + 1);
}
break;
......@@ -408,8 +401,7 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
{
/* No fixme here because this might happen because of sloppy apps */
WARN("Leftover stateblock handle %d, deleting\n", i + 1);
IDirect3DDevice7_DeleteStateBlock(ICOM_INTERFACE(This, IDirect3DDevice7),
i + 1);
IDirect3DDevice7_DeleteStateBlock((IDirect3DDevice7 *)This, i + 1);
}
break;
......@@ -425,8 +417,8 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
/* Release the render target and the WineD3D render target
* (See IDirect3D7::CreateDevice for more comments on this)
*/
IDirectDrawSurface7_Release(ICOM_INTERFACE(This->target, IDirectDrawSurface7));
IDirectDrawSurface7_Release(ICOM_INTERFACE(This->ddraw->d3d_target,IDirectDrawSurface7));
IDirectDrawSurface7_Release((IDirectDrawSurface7 *)This->target);
IDirectDrawSurface7_Release((IDirectDrawSurface7 *)This->ddraw->d3d_target);
TRACE("Target release done\n");
This->ddraw->d3ddevice = NULL;
......@@ -445,7 +437,7 @@ Thunk_IDirect3DDeviceImpl_3_Release(IDirect3DDevice3 *iface)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DDevice7 interface.\n", This);
return IDirect3DDevice7_Release(ICOM_INTERFACE(This, IDirect3DDevice7));
return IDirect3DDevice7_Release((IDirect3DDevice7 *)This);
}
static ULONG WINAPI
......@@ -453,7 +445,7 @@ Thunk_IDirect3DDeviceImpl_2_Release(IDirect3DDevice2 *iface)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DDevice7 interface.\n", This);
return IDirect3DDevice7_Release(ICOM_INTERFACE(This, IDirect3DDevice7));
return IDirect3DDevice7_Release((IDirect3DDevice7 *)This);
}
static ULONG WINAPI
......@@ -461,7 +453,7 @@ Thunk_IDirect3DDeviceImpl_1_Release(IDirect3DDevice *iface)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DDevice7 interface.\n", This);
return IDirect3DDevice7_Release(ICOM_INTERFACE(This, IDirect3DDevice7));
return IDirect3DDevice7_Release((IDirect3DDevice7 *)This);
}
/*****************************************************************************
......@@ -586,9 +578,7 @@ Thunk_IDirect3DDeviceImpl_2_GetCaps(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%p,%p) thunking to IDirect3DDevice3 interface.\n", This, D3DHWDevDesc, D3DHELDevDesc);
return IDirect3DDevice3_GetCaps(ICOM_INTERFACE(This, IDirect3DDevice3),
D3DHWDevDesc,
D3DHELDevDesc);
return IDirect3DDevice3_GetCaps((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, D3DHWDevDesc, D3DHELDevDesc);
}
static HRESULT WINAPI
......@@ -598,9 +588,7 @@ Thunk_IDirect3DDeviceImpl_1_GetCaps(IDirect3DDevice *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
TRACE_(ddraw_thunk)("(%p)->(%p,%p) thunking to IDirect3DDevice3 interface.\n", This, D3DHWDevDesc, D3DHELDevDesc);
return IDirect3DDevice3_GetCaps(ICOM_INTERFACE(This, IDirect3DDevice3),
D3DHWDevDesc,
D3DHELDevDesc);
return IDirect3DDevice3_GetCaps((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, D3DHWDevDesc, D3DHELDevDesc);
}
/*****************************************************************************
......@@ -646,10 +634,10 @@ Thunk_IDirect3DDeviceImpl_1_SwapTextureHandles(IDirect3DDevice *iface,
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
IDirectDrawSurfaceImpl *surf1 = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirect3DTexture, D3DTex1);
IDirectDrawSurfaceImpl *surf2 = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirect3DTexture, D3DTex2);
IDirect3DTexture2 *t1 = surf1 ? (IDirect3DTexture2 *)&surf1->IDirect3DTexture2_vtbl : NULL;
IDirect3DTexture2 *t2 = surf2 ? (IDirect3DTexture2 *)&surf2->IDirect3DTexture2_vtbl : NULL;
TRACE_(ddraw_thunk)("(%p)->(%p,%p) thunking to IDirect3DDevice2 interface.\n", This, surf1, surf2);
return IDirect3DDevice2_SwapTextureHandles(ICOM_INTERFACE(This, IDirect3DDevice2),
ICOM_INTERFACE(surf1, IDirect3DTexture2),
ICOM_INTERFACE(surf2, IDirect3DTexture2));
return IDirect3DDevice2_SwapTextureHandles((IDirect3DDevice2 *)&This->IDirect3DDevice2_vtbl, t1, t2);
}
/*****************************************************************************
......@@ -696,8 +684,7 @@ Thunk_IDirect3DDeviceImpl_2_GetStats(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", This, Stats);
return IDirect3DDevice3_GetStats(ICOM_INTERFACE(This, IDirect3DDevice3),
Stats);
return IDirect3DDevice3_GetStats((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, Stats);
}
static HRESULT WINAPI
......@@ -706,8 +693,7 @@ Thunk_IDirect3DDeviceImpl_1_GetStats(IDirect3DDevice *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", This, Stats);
return IDirect3DDevice3_GetStats(ICOM_INTERFACE(This, IDirect3DDevice3),
Stats);
return IDirect3DDevice3_GetStats((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, Stats);
}
/*****************************************************************************
......@@ -791,7 +777,7 @@ IDirect3DDeviceImpl_1_CreateExecuteBuffer(IDirect3DDevice *iface,
object->indices = NULL;
object->nb_indices = 0;
*ExecuteBuffer = ICOM_INTERFACE(object, IDirect3DExecuteBuffer);
*ExecuteBuffer = (IDirect3DExecuteBuffer *)object;
TRACE(" Returning IDirect3DExecuteBuffer at %p, implementation is at %p\n", *ExecuteBuffer, object);
......@@ -883,8 +869,7 @@ Thunk_IDirect3DDeviceImpl_2_AddViewport(IDirect3DDevice2 *iface,
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
IDirect3DViewportImpl *vp = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, Direct3DViewport2);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", This, vp);
return IDirect3DDevice3_AddViewport(ICOM_INTERFACE(This, IDirect3DDevice3),
ICOM_INTERFACE(vp, IDirect3DViewport3));
return IDirect3DDevice3_AddViewport((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, (IDirect3DViewport3 *)vp);
}
static HRESULT WINAPI
......@@ -894,8 +879,7 @@ Thunk_IDirect3DDeviceImpl_1_AddViewport(IDirect3DDevice *iface,
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
IDirect3DViewportImpl *vp = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, Direct3DViewport);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", This, vp);
return IDirect3DDevice3_AddViewport(ICOM_INTERFACE(This, IDirect3DDevice3),
ICOM_INTERFACE(vp, IDirect3DViewport3));
return IDirect3DDevice3_AddViewport((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, (IDirect3DViewport3 *)vp);
}
/*****************************************************************************
......@@ -951,8 +935,7 @@ Thunk_IDirect3DDeviceImpl_2_DeleteViewport(IDirect3DDevice2 *iface,
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
IDirect3DViewportImpl *vp = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, Direct3DViewport2);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", This, vp);
return IDirect3DDevice3_DeleteViewport(ICOM_INTERFACE(This, IDirect3DDevice3),
ICOM_INTERFACE(vp, IDirect3DViewport3));
return IDirect3DDevice3_DeleteViewport((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, (IDirect3DViewport3 *)vp);
}
static HRESULT WINAPI
......@@ -962,8 +945,7 @@ Thunk_IDirect3DDeviceImpl_1_DeleteViewport(IDirect3DDevice *iface,
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
IDirect3DViewportImpl *vp = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, Direct3DViewport);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", This, vp);
return IDirect3DDevice3_DeleteViewport(ICOM_INTERFACE(This, IDirect3DDevice3),
ICOM_INTERFACE(vp, IDirect3DViewport3));
return IDirect3DDevice3_DeleteViewport((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, (IDirect3DViewport3 *)vp);
}
/*****************************************************************************
......@@ -1032,7 +1014,7 @@ IDirect3DDeviceImpl_3_NextViewport(IDirect3DDevice3 *iface,
return DDERR_INVALIDPARAMS;
}
*lplpDirect3DViewport3 = ICOM_INTERFACE(res, IDirect3DViewport3);
*lplpDirect3DViewport3 = (IDirect3DViewport3 *)res;
LeaveCriticalSection(&ddraw_cs);
return D3D_OK;
}
......@@ -1048,10 +1030,8 @@ Thunk_IDirect3DDeviceImpl_2_NextViewport(IDirect3DDevice2 *iface,
IDirect3DViewport3 *res;
HRESULT hr;
TRACE_(ddraw_thunk)("(%p)->(%p,%p,%08x) thunking to IDirect3DDevice3 interface.\n", This, vp, lplpDirect3DViewport2, Flags);
hr = IDirect3DDevice3_NextViewport(ICOM_INTERFACE(This, IDirect3DDevice3),
ICOM_INTERFACE(vp, IDirect3DViewport3),
&res,
Flags);
hr = IDirect3DDevice3_NextViewport((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl,
(IDirect3DViewport3 *)vp, &res, Flags);
*lplpDirect3DViewport2 = (IDirect3DViewport2 *) COM_INTERFACE_CAST(IDirect3DViewportImpl, IDirect3DViewport3, IDirect3DViewport3, res);
return hr;
}
......@@ -1067,10 +1047,8 @@ Thunk_IDirect3DDeviceImpl_1_NextViewport(IDirect3DDevice *iface,
IDirect3DViewport3 *res;
HRESULT hr;
TRACE_(ddraw_thunk)("(%p)->(%p,%p,%08x) thunking to IDirect3DDevice3 interface.\n", This, vp, lplpDirect3DViewport, Flags);
hr = IDirect3DDevice3_NextViewport(ICOM_INTERFACE(This, IDirect3DDevice3),
ICOM_INTERFACE(vp, IDirect3DViewport3),
&res,
Flags);
hr = IDirect3DDevice3_NextViewport((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl,
(IDirect3DViewport3 *)vp, &res, Flags);
*lplpDirect3DViewport = (IDirect3DViewport *) COM_INTERFACE_CAST(IDirect3DViewportImpl, IDirect3DViewport3, IDirect3DViewport3, res);
return hr;
}
......@@ -1306,9 +1284,7 @@ Thunk_IDirect3DDeviceImpl_3_EnumTextureFormats(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%p,%p) thunking to IDirect3DDevice7 interface.\n", This, Callback, Arg);
return IDirect3DDevice7_EnumTextureFormats(ICOM_INTERFACE(This, IDirect3DDevice7),
Callback,
Arg);
return IDirect3DDevice7_EnumTextureFormats((IDirect3DDevice7 *)This, Callback, Arg);
}
/*****************************************************************************
......@@ -1408,9 +1384,7 @@ Thunk_IDirect3DDeviceImpl_1_EnumTextureFormats(IDirect3DDevice *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
TRACE_(ddraw_thunk)("(%p)->(%p,%p) thunking to IDirect3DDevice2 interface.\n", This, Callback, Arg);
return IDirect3DDevice2_EnumTextureFormats(ICOM_INTERFACE(This, IDirect3DDevice2),
Callback,
Arg);
return IDirect3DDevice2_EnumTextureFormats((IDirect3DDevice2 *)&This->IDirect3DDevice2_vtbl, Callback, Arg);
}
/*****************************************************************************
......@@ -1683,7 +1657,7 @@ Thunk_IDirect3DDeviceImpl_3_BeginScene(IDirect3DDevice3 *iface)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DDevice7 interface.\n", This);
return IDirect3DDevice7_BeginScene(ICOM_INTERFACE(This, IDirect3DDevice7));
return IDirect3DDevice7_BeginScene((IDirect3DDevice7 *)This);
}
static HRESULT WINAPI
......@@ -1691,7 +1665,7 @@ Thunk_IDirect3DDeviceImpl_2_BeginScene(IDirect3DDevice2 *iface)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DDevice7 interface.\n", This);
return IDirect3DDevice7_BeginScene(ICOM_INTERFACE(This, IDirect3DDevice7));
return IDirect3DDevice7_BeginScene((IDirect3DDevice7 *)This);
}
static HRESULT WINAPI
......@@ -1699,7 +1673,7 @@ Thunk_IDirect3DDeviceImpl_1_BeginScene(IDirect3DDevice *iface)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DDevice7 interface.\n", This);
return IDirect3DDevice7_BeginScene(ICOM_INTERFACE(This, IDirect3DDevice7));
return IDirect3DDevice7_BeginScene((IDirect3DDevice7 *)This);
}
/*****************************************************************************
......@@ -1754,7 +1728,7 @@ Thunk_IDirect3DDeviceImpl_3_EndScene(IDirect3DDevice3 *iface)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DDevice7 interface.\n", This);
return IDirect3DDevice7_EndScene(ICOM_INTERFACE(This, IDirect3DDevice7));
return IDirect3DDevice7_EndScene((IDirect3DDevice7 *)This);
}
static HRESULT WINAPI
......@@ -1762,7 +1736,7 @@ Thunk_IDirect3DDeviceImpl_2_EndScene(IDirect3DDevice2 *iface)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DDevice7 interface.\n", This);
return IDirect3DDevice7_EndScene(ICOM_INTERFACE(This, IDirect3DDevice7));
return IDirect3DDevice7_EndScene((IDirect3DDevice7 *)This);
}
static HRESULT WINAPI
......@@ -1770,7 +1744,7 @@ Thunk_IDirect3DDeviceImpl_1_EndScene(IDirect3DDevice *iface)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DDevice7 interface.\n", This);
return IDirect3DDevice7_EndScene(ICOM_INTERFACE(This, IDirect3DDevice7));
return IDirect3DDevice7_EndScene((IDirect3DDevice7 *)This);
}
/*****************************************************************************
......@@ -1797,7 +1771,7 @@ IDirect3DDeviceImpl_7_GetDirect3D(IDirect3DDevice7 *iface,
if(!Direct3D7)
return DDERR_INVALIDPARAMS;
*Direct3D7 = ICOM_INTERFACE(This->ddraw, IDirect3D7);
*Direct3D7 = (IDirect3D7 *)&This->ddraw->IDirect3D7_vtbl;
IDirect3D7_AddRef(*Direct3D7);
TRACE(" returning interface %p\n", *Direct3D7);
......@@ -1813,8 +1787,7 @@ Thunk_IDirect3DDeviceImpl_3_GetDirect3D(IDirect3DDevice3 *iface,
IDirect3D7 *ret_ptr;
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", This, Direct3D3);
ret = IDirect3DDevice7_GetDirect3D(ICOM_INTERFACE(This, IDirect3DDevice7),
&ret_ptr);
ret = IDirect3DDevice7_GetDirect3D((IDirect3DDevice7 *)This, &ret_ptr);
if(ret != D3D_OK)
return ret;
*Direct3D3 = COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D7, IDirect3D3, ret_ptr);
......@@ -1831,8 +1804,7 @@ Thunk_IDirect3DDeviceImpl_2_GetDirect3D(IDirect3DDevice2 *iface,
IDirect3D7 *ret_ptr;
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", This, Direct3D2);
ret = IDirect3DDevice7_GetDirect3D(ICOM_INTERFACE(This, IDirect3DDevice7),
&ret_ptr);
ret = IDirect3DDevice7_GetDirect3D((IDirect3DDevice7 *)This, &ret_ptr);
if(ret != D3D_OK)
return ret;
*Direct3D2 = COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D7, IDirect3D2, ret_ptr);
......@@ -1849,8 +1821,7 @@ Thunk_IDirect3DDeviceImpl_1_GetDirect3D(IDirect3DDevice *iface,
IDirect3D7 *ret_ptr;
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", This, Direct3D);
ret = IDirect3DDevice7_GetDirect3D(ICOM_INTERFACE(This, IDirect3DDevice7),
&ret_ptr);
ret = IDirect3DDevice7_GetDirect3D((IDirect3DDevice7 *)This, &ret_ptr);
if(ret != D3D_OK)
return ret;
*Direct3D = COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D7, IDirect3D, ret_ptr);
......@@ -1895,8 +1866,9 @@ IDirect3DDeviceImpl_3_SetCurrentViewport(IDirect3DDevice3 *iface,
/* Release previous viewport and AddRef the new one */
if (This->current_viewport)
{
TRACE("ViewportImpl is at %p, interface is at %p\n", This->current_viewport, ICOM_INTERFACE(This->current_viewport, IDirect3DViewport3));
IDirect3DViewport3_Release( ICOM_INTERFACE(This->current_viewport, IDirect3DViewport3) );
TRACE("ViewportImpl is at %p, interface is at %p\n", This->current_viewport,
(IDirect3DViewport3 *)This->current_viewport);
IDirect3DViewport3_Release((IDirect3DViewport3 *)This->current_viewport);
}
IDirect3DViewport3_AddRef(Direct3DViewport3);
......@@ -1918,8 +1890,8 @@ Thunk_IDirect3DDeviceImpl_2_SetCurrentViewport(IDirect3DDevice2 *iface,
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
IDirect3DViewportImpl *vp = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, Direct3DViewport2);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", This, vp);
return IDirect3DDevice3_SetCurrentViewport(ICOM_INTERFACE(This, IDirect3DDevice3),
ICOM_INTERFACE(vp, IDirect3DViewport3));
return IDirect3DDevice3_SetCurrentViewport((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl,
(IDirect3DViewport3 *)vp);
}
/*****************************************************************************
......@@ -1948,7 +1920,7 @@ IDirect3DDeviceImpl_3_GetCurrentViewport(IDirect3DDevice3 *iface,
return DDERR_INVALIDPARAMS;
EnterCriticalSection(&ddraw_cs);
*Direct3DViewport3 = ICOM_INTERFACE(This->current_viewport, IDirect3DViewport3);
*Direct3DViewport3 = (IDirect3DViewport3 *)This->current_viewport;
/* AddRef the returned viewport */
if(*Direct3DViewport3) IDirect3DViewport3_AddRef(*Direct3DViewport3);
......@@ -1966,8 +1938,8 @@ Thunk_IDirect3DDeviceImpl_2_GetCurrentViewport(IDirect3DDevice2 *iface,
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
HRESULT hr;
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", This, Direct3DViewport2);
hr = IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This, IDirect3DDevice3),
(IDirect3DViewport3 **) Direct3DViewport2);
hr = IDirect3DDevice3_GetCurrentViewport((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl,
(IDirect3DViewport3 **)Direct3DViewport2);
if(hr != D3D_OK) return hr;
*Direct3DViewport2 = (IDirect3DViewport2 *) COM_INTERFACE_CAST(IDirect3DViewportImpl, IDirect3DViewport3, IDirect3DViewport3, *Direct3DViewport2);
return D3D_OK;
......@@ -2020,7 +1992,7 @@ IDirect3DDeviceImpl_7_SetRenderTarget(IDirect3DDevice7 *iface,
return hr;
}
IDirectDrawSurface7_AddRef(NewTarget);
IDirectDrawSurface7_Release(ICOM_INTERFACE(This->target, IDirectDrawSurface7));
IDirectDrawSurface7_Release((IDirectDrawSurface7 *)This->target);
This->target = Target;
IDirect3DDeviceImpl_UpdateDepthStencil(This);
LeaveCriticalSection(&ddraw_cs);
......@@ -2058,9 +2030,7 @@ Thunk_IDirect3DDeviceImpl_3_SetRenderTarget(IDirect3DDevice3 *iface,
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
IDirectDrawSurfaceImpl *Target = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, NewRenderTarget);
TRACE_(ddraw_thunk)("(%p)->(%p,%08x) thunking to IDirect3DDevice7 interface.\n", This, Target, Flags);
return IDirect3DDevice7_SetRenderTarget(ICOM_INTERFACE(This, IDirect3DDevice7),
ICOM_INTERFACE(Target, IDirectDrawSurface7),
Flags);
return IDirect3DDevice7_SetRenderTarget((IDirect3DDevice7 *)This, (IDirectDrawSurface7 *)Target, Flags);
}
static HRESULT WINAPI
......@@ -2071,9 +2041,7 @@ Thunk_IDirect3DDeviceImpl_2_SetRenderTarget(IDirect3DDevice2 *iface,
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
IDirectDrawSurfaceImpl *Target = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface3, NewRenderTarget);
TRACE_(ddraw_thunk)("(%p)->(%p,%08x) thunking to IDirect3DDevice7 interface.\n", This, Target, Flags);
return IDirect3DDevice7_SetRenderTarget(ICOM_INTERFACE(This, IDirect3DDevice7),
ICOM_INTERFACE(Target, IDirectDrawSurface7),
Flags);
return IDirect3DDevice7_SetRenderTarget((IDirect3DDevice7 *)This, (IDirectDrawSurface7 *)Target, Flags);
}
/*****************************************************************************
......@@ -2104,7 +2072,7 @@ IDirect3DDeviceImpl_7_GetRenderTarget(IDirect3DDevice7 *iface,
return DDERR_INVALIDPARAMS;
EnterCriticalSection(&ddraw_cs);
*RenderTarget = ICOM_INTERFACE(This->target, IDirectDrawSurface7);
*RenderTarget = (IDirectDrawSurface7 *)This->target;
IDirectDrawSurface7_AddRef(*RenderTarget);
LeaveCriticalSection(&ddraw_cs);
......@@ -2118,8 +2086,7 @@ Thunk_IDirect3DDeviceImpl_3_GetRenderTarget(IDirect3DDevice3 *iface,
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
HRESULT hr;
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", This, RenderTarget);
hr = IDirect3DDevice7_GetRenderTarget(ICOM_INTERFACE(This, IDirect3DDevice7),
(IDirectDrawSurface7 **) RenderTarget);
hr = IDirect3DDevice7_GetRenderTarget((IDirect3DDevice7 *)This, (IDirectDrawSurface7 **)RenderTarget);
if(hr != D3D_OK) return hr;
*RenderTarget = (IDirectDrawSurface4 *) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirectDrawSurface7, *RenderTarget);
return D3D_OK;
......@@ -2132,8 +2099,7 @@ Thunk_IDirect3DDeviceImpl_2_GetRenderTarget(IDirect3DDevice2 *iface,
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
HRESULT hr;
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", This, RenderTarget);
hr = IDirect3DDevice7_GetRenderTarget(ICOM_INTERFACE(This, IDirect3DDevice7),
(IDirectDrawSurface7 **) RenderTarget);
hr = IDirect3DDevice7_GetRenderTarget((IDirect3DDevice7 *)This, (IDirectDrawSurface7 **)RenderTarget);
if(hr != D3D_OK) return hr;
*RenderTarget = (IDirectDrawSurface *) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirectDrawSurface3, *RenderTarget);
return D3D_OK;
......@@ -2197,10 +2163,7 @@ Thunk_IDirect3DDeviceImpl_2_Begin(IDirect3DDevice2 *iface,
return DDERR_INVALIDPARAMS; /* Should never happen */
};
return IDirect3DDevice3_Begin(ICOM_INTERFACE(This, IDirect3DDevice3),
d3dpt,
FVF,
dwFlags);
return IDirect3DDevice3_Begin((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, d3dpt, FVF, dwFlags);
}
/*****************************************************************************
......@@ -2258,12 +2221,8 @@ Thunk_IDirect3DDeviceImpl_2_BeginIndexed(IDirect3DDevice2 *iface,
return DDERR_INVALIDPARAMS; /* Should never happen */
};
return IDirect3DDevice3_BeginIndexed(ICOM_INTERFACE(This,IDirect3DDevice3),
d3dptPrimitiveType,
FVF,
lpvVertices,
dwNumVertices,
dwFlags);
return IDirect3DDevice3_BeginIndexed((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl,
d3dptPrimitiveType, FVF, lpvVertices, dwNumVertices, dwFlags);
}
/*****************************************************************************
......@@ -2319,8 +2278,7 @@ Thunk_IDirect3DDeviceImpl_2_Vertex(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", This, lpVertexType);
return IDirect3DDevice3_Vertex(ICOM_INTERFACE(This, IDirect3DDevice3),
lpVertexType);
return IDirect3DDevice3_Vertex((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, lpVertexType);
}
/*****************************************************************************
......@@ -2351,8 +2309,7 @@ Thunk_IDirect3DDeviceImpl_2_Index(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%04x) thunking to IDirect3DDevice3 interface.\n", This, wVertexIndex);
return IDirect3DDevice3_Index(ICOM_INTERFACE(This, IDirect3DDevice3),
wVertexIndex);
return IDirect3DDevice3_Index((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, wVertexIndex);
}
/*****************************************************************************
......@@ -2380,10 +2337,8 @@ IDirect3DDeviceImpl_3_End(IDirect3DDevice3 *iface,
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE("(%p)->(%08x)\n", This, Flags);
return IDirect3DDevice7_DrawPrimitive(ICOM_INTERFACE(This, IDirect3DDevice7),
This->primitive_type, This->vertex_type,
This->vertex_buffer, This->nb_vertices,
This->render_flags);
return IDirect3DDevice7_DrawPrimitive((IDirect3DDevice7 *)This, This->primitive_type,
This->vertex_type, This->vertex_buffer, This->nb_vertices, This->render_flags);
}
static HRESULT WINAPI
......@@ -2392,8 +2347,7 @@ Thunk_IDirect3DDeviceImpl_2_End(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x) thunking to IDirect3DDevice3 interface.\n", This, dwFlags);
return IDirect3DDevice3_End(ICOM_INTERFACE(This, IDirect3DDevice3),
dwFlags);
return IDirect3DDevice3_End((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, dwFlags);
}
/*****************************************************************************
......@@ -2644,9 +2598,7 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface,
}
default:
return IDirect3DDevice7_GetRenderState(ICOM_INTERFACE(This, IDirect3DDevice7),
dwRenderStateType,
lpdwRenderState);
return IDirect3DDevice7_GetRenderState((IDirect3DDevice7 *)This, dwRenderStateType, lpdwRenderState);
}
}
......@@ -2657,9 +2609,8 @@ Thunk_IDirect3DDeviceImpl_2_GetRenderState(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%p) thunking to IDirect3DDevice3 interface.\n", This, dwRenderStateType, lpdwRenderState);
return IDirect3DDevice3_GetRenderState(ICOM_INTERFACE(This, IDirect3DDevice3),
dwRenderStateType,
lpdwRenderState);
return IDirect3DDevice3_GetRenderState((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl,
dwRenderStateType, lpdwRenderState);
}
/*****************************************************************************
......@@ -2868,7 +2819,8 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface,
else
{
IDirectDrawSurfaceImpl *surf = This->Handles[Value - 1].ptr;
hr = IDirect3DDevice3_SetTexture(iface, 0, ICOM_INTERFACE(surf, IDirect3DTexture2));
IDirect3DTexture2 *tex = surf ? (IDirect3DTexture2 *)&surf->IDirect3DTexture2_vtbl : NULL;
hr = IDirect3DDevice3_SetTexture(iface, 0, tex);
break;
}
}
......@@ -2965,9 +2917,7 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface,
}
default:
hr = IDirect3DDevice7_SetRenderState(ICOM_INTERFACE(This, IDirect3DDevice7),
RenderStateType,
Value);
hr = IDirect3DDevice7_SetRenderState((IDirect3DDevice7 *)This, RenderStateType, Value);
break;
}
......@@ -2983,7 +2933,7 @@ Thunk_IDirect3DDeviceImpl_2_SetRenderState(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%d) thunking to IDirect3DDevice3 interface.\n", This, RenderStateType, Value);
return IDirect3DDevice3_SetRenderState(ICOM_INTERFACE(This, IDirect3DDevice3), RenderStateType, Value);
return IDirect3DDevice3_SetRenderState((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, RenderStateType, Value);
}
/*****************************************************************************
......@@ -3100,9 +3050,7 @@ IDirect3DDeviceImpl_3_SetLightState(IDirect3DDevice3 *iface,
return DDERR_INVALIDPARAMS;
}
hr = IDirect3DDevice7_SetRenderState(ICOM_INTERFACE(This, IDirect3DDevice7),
rs,
Value);
hr = IDirect3DDevice7_SetRenderState((IDirect3DDevice7 *)This, rs, Value);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
......@@ -3118,9 +3066,7 @@ Thunk_IDirect3DDeviceImpl_2_SetLightState(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%08x) thunking to IDirect3DDevice3 interface.\n", This, LightStateType, Value);
return IDirect3DDevice3_SetLightState(ICOM_INTERFACE(This, IDirect3DDevice3),
LightStateType,
Value);
return IDirect3DDevice3_SetLightState((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, LightStateType, Value);
}
/*****************************************************************************
......@@ -3198,9 +3144,7 @@ IDirect3DDeviceImpl_3_GetLightState(IDirect3DDevice3 *iface,
return DDERR_INVALIDPARAMS;
}
hr = IDirect3DDevice7_GetRenderState(ICOM_INTERFACE(This, IDirect3DDevice7),
rs,
Value);
hr = IDirect3DDevice7_GetRenderState((IDirect3DDevice7 *)This, rs, Value);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
......@@ -3216,9 +3160,7 @@ Thunk_IDirect3DDeviceImpl_2_GetLightState(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%p) thunking to IDirect3DDevice3 interface.\n", This, LightStateType, Value);
return IDirect3DDevice3_GetLightState(ICOM_INTERFACE(This, IDirect3DDevice3),
LightStateType,
Value);
return IDirect3DDevice3_GetLightState((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, LightStateType, Value);
}
/*****************************************************************************
......@@ -3303,9 +3245,7 @@ Thunk_IDirect3DDeviceImpl_3_SetTransform(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", This, TransformStateType, D3DMatrix);
return IDirect3DDevice7_SetTransform(ICOM_INTERFACE(This, IDirect3DDevice7),
TransformStateType,
D3DMatrix);
return IDirect3DDevice7_SetTransform((IDirect3DDevice7 *)This, TransformStateType, D3DMatrix);
}
static HRESULT WINAPI
......@@ -3315,9 +3255,7 @@ Thunk_IDirect3DDeviceImpl_2_SetTransform(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", This, TransformStateType, D3DMatrix);
return IDirect3DDevice7_SetTransform(ICOM_INTERFACE(This, IDirect3DDevice7),
TransformStateType,
D3DMatrix);
return IDirect3DDevice7_SetTransform((IDirect3DDevice7 *)This, TransformStateType, D3DMatrix);
}
/*****************************************************************************
......@@ -3396,9 +3334,7 @@ Thunk_IDirect3DDeviceImpl_3_GetTransform(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", This, TransformStateType, D3DMatrix);
return IDirect3DDevice7_GetTransform(ICOM_INTERFACE(This, IDirect3DDevice7),
TransformStateType,
D3DMatrix);
return IDirect3DDevice7_GetTransform((IDirect3DDevice7 *)This, TransformStateType, D3DMatrix);
}
static HRESULT WINAPI
......@@ -3408,9 +3344,7 @@ Thunk_IDirect3DDeviceImpl_2_GetTransform(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", This, TransformStateType, D3DMatrix);
return IDirect3DDevice7_GetTransform(ICOM_INTERFACE(This, IDirect3DDevice7),
TransformStateType,
D3DMatrix);
return IDirect3DDevice7_GetTransform((IDirect3DDevice7 *)This, TransformStateType, D3DMatrix);
}
/*****************************************************************************
......@@ -3489,9 +3423,7 @@ Thunk_IDirect3DDeviceImpl_3_MultiplyTransform(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", This, TransformStateType, D3DMatrix);
return IDirect3DDevice7_MultiplyTransform(ICOM_INTERFACE(This, IDirect3DDevice7),
TransformStateType,
D3DMatrix);
return IDirect3DDevice7_MultiplyTransform((IDirect3DDevice7 *)This, TransformStateType, D3DMatrix);
}
static HRESULT WINAPI
......@@ -3501,9 +3433,7 @@ Thunk_IDirect3DDeviceImpl_2_MultiplyTransform(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", This, TransformStateType, D3DMatrix);
return IDirect3DDevice7_MultiplyTransform(ICOM_INTERFACE(This, IDirect3DDevice7),
TransformStateType,
D3DMatrix);
return IDirect3DDevice7_MultiplyTransform((IDirect3DDevice7 *)This, TransformStateType, D3DMatrix);
}
/*****************************************************************************
......@@ -3636,12 +3566,8 @@ Thunk_IDirect3DDeviceImpl_3_DrawPrimitive(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%08x,%p,%08x,%08x) thunking to IDirect3DDevice7 interface.\n", This, PrimitiveType, VertexType, Vertices, VertexCount, Flags);
return IDirect3DDevice7_DrawPrimitive(ICOM_INTERFACE(This, IDirect3DDevice7),
PrimitiveType,
VertexType,
Vertices,
VertexCount,
Flags);
return IDirect3DDevice7_DrawPrimitive((IDirect3DDevice7 *)This,
PrimitiveType, VertexType, Vertices, VertexCount, Flags);
}
static HRESULT WINAPI
......@@ -3666,12 +3592,7 @@ Thunk_IDirect3DDeviceImpl_2_DrawPrimitive(IDirect3DDevice2 *iface,
return DDERR_INVALIDPARAMS; /* Should never happen */
}
return IDirect3DDevice7_DrawPrimitive(ICOM_INTERFACE(This, IDirect3DDevice7),
PrimitiveType,
FVF,
Vertices,
VertexCount,
Flags);
return IDirect3DDevice7_DrawPrimitive((IDirect3DDevice7 *)This, PrimitiveType, FVF, Vertices, VertexCount, Flags);
}
/*****************************************************************************
......@@ -3813,14 +3734,8 @@ Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitive(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%08x,%p,%08x,%p,%08x,%08x) thunking to IDirect3DDevice7 interface.\n", This, PrimitiveType, VertexType, Vertices, VertexCount, Indices, IndexCount, Flags);
return IDirect3DDevice7_DrawIndexedPrimitive(ICOM_INTERFACE(This, IDirect3DDevice7),
PrimitiveType,
VertexType,
Vertices,
VertexCount,
Indices,
IndexCount,
Flags);
return IDirect3DDevice7_DrawIndexedPrimitive((IDirect3DDevice7 *)This,
PrimitiveType, VertexType, Vertices, VertexCount, Indices, IndexCount, Flags);
}
static HRESULT WINAPI
......@@ -3847,14 +3762,8 @@ Thunk_IDirect3DDeviceImpl_2_DrawIndexedPrimitive(IDirect3DDevice2 *iface,
return DDERR_INVALIDPARAMS; /* Should never happen */
}
return IDirect3DDevice7_DrawIndexedPrimitive(ICOM_INTERFACE(This, IDirect3DDevice7),
PrimitiveType,
FVF,
Vertices,
VertexCount,
Indices,
IndexCount,
Flags);
return IDirect3DDevice7_DrawIndexedPrimitive((IDirect3DDevice7 *)This,
PrimitiveType, FVF, Vertices, VertexCount, Indices, IndexCount, Flags);
}
/*****************************************************************************
......@@ -3893,8 +3802,7 @@ Thunk_IDirect3DDeviceImpl_3_SetClipStatus(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", This, ClipStatus);
return IDirect3DDevice7_SetClipStatus(ICOM_INTERFACE(This, IDirect3DDevice7),
ClipStatus);
return IDirect3DDevice7_SetClipStatus((IDirect3DDevice7 *)This, ClipStatus);
}
static HRESULT WINAPI
......@@ -3903,8 +3811,7 @@ Thunk_IDirect3DDeviceImpl_2_SetClipStatus(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", This, ClipStatus);
return IDirect3DDevice7_SetClipStatus(ICOM_INTERFACE(This, IDirect3DDevice7),
ClipStatus);
return IDirect3DDevice7_SetClipStatus((IDirect3DDevice7 *)This, ClipStatus);
}
/*****************************************************************************
......@@ -3937,8 +3844,7 @@ Thunk_IDirect3DDeviceImpl_3_GetClipStatus(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", This, ClipStatus);
return IDirect3DDevice7_GetClipStatus(ICOM_INTERFACE(This, IDirect3DDevice7),
ClipStatus);
return IDirect3DDevice7_GetClipStatus((IDirect3DDevice7 *)This, ClipStatus);
}
static HRESULT WINAPI
......@@ -3947,8 +3853,7 @@ Thunk_IDirect3DDeviceImpl_2_GetClipStatus(IDirect3DDevice2 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", This, ClipStatus);
return IDirect3DDevice7_GetClipStatus(ICOM_INTERFACE(This, IDirect3DDevice7),
ClipStatus);
return IDirect3DDevice7_GetClipStatus((IDirect3DDevice7 *)This, ClipStatus);
}
/*****************************************************************************
......@@ -4123,12 +4028,8 @@ Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveStrided(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%08x,%p,%08x,%08x) thunking to IDirect3DDevice7 interface.\n", This, PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount, Flags);
return IDirect3DDevice7_DrawPrimitiveStrided(ICOM_INTERFACE(This, IDirect3DDevice7),
PrimitiveType,
VertexType,
D3DDrawPrimStrideData,
VertexCount,
Flags);
return IDirect3DDevice7_DrawPrimitiveStrided((IDirect3DDevice7 *)This,
PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount, Flags);
}
/*****************************************************************************
......@@ -4310,14 +4211,8 @@ Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveStrided(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%08x,%p,%08x,%p,%08x,%08x) thunking to IDirect3DDevice7 interface.\n", iface, PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount, Indices, IndexCount, Flags);
return IDirect3DDevice7_DrawIndexedPrimitiveStrided(ICOM_INTERFACE(This, IDirect3DDevice7),
PrimitiveType,
VertexType,
D3DDrawPrimStrideData,
VertexCount,
Indices,
IndexCount,
Flags);
return IDirect3DDevice7_DrawIndexedPrimitiveStrided((IDirect3DDevice7 *)This, PrimitiveType,
VertexType, D3DDrawPrimStrideData, VertexCount, Indices, IndexCount, Flags);
}
/*****************************************************************************
......@@ -4477,12 +4372,8 @@ Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveVB(IDirect3DDevice3 *iface,
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
IDirect3DVertexBufferImpl *vb = ICOM_OBJECT(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, D3DVertexBuf);
TRACE_(ddraw_thunk)("(%p)->(%08x,%p,%08x,%08x,%08x) thunking to IDirect3DDevice7 interface.\n", This, PrimitiveType, vb, StartVertex, NumVertices, Flags);
return IDirect3DDevice7_DrawPrimitiveVB(ICOM_INTERFACE(This, IDirect3DDevice7),
PrimitiveType,
ICOM_INTERFACE(vb, IDirect3DVertexBuffer7),
StartVertex,
NumVertices,
Flags);
return IDirect3DDevice7_DrawPrimitiveVB((IDirect3DDevice7 *)This, PrimitiveType,
(IDirect3DVertexBuffer7 *)vb, StartVertex, NumVertices, Flags);
}
......@@ -4684,14 +4575,8 @@ Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB(IDirect3DDevice3 *iface,
IDirect3DVertexBufferImpl *VB = ICOM_OBJECT(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, D3DVertexBuf);
TRACE_(ddraw_thunk)("(%p)->(%08x,%p,%p,%08x,%08x) thunking to IDirect3DDevice7 interface.\n", This, PrimitiveType, VB, Indices, IndexCount, Flags);
return IDirect3DDevice7_DrawIndexedPrimitiveVB(ICOM_INTERFACE(This, IDirect3DDevice7),
PrimitiveType,
ICOM_INTERFACE(VB, IDirect3DVertexBuffer7),
0,
IndexCount,
Indices,
IndexCount,
Flags);
return IDirect3DDevice7_DrawIndexedPrimitiveVB((IDirect3DDevice7 *)This, PrimitiveType,
(IDirect3DVertexBuffer7 *)VB, 0, IndexCount, Indices, IndexCount, Flags);
}
/*****************************************************************************
......@@ -4768,12 +4653,8 @@ Thunk_IDirect3DDeviceImpl_3_ComputeSphereVisibility(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%p,%p,%08x,%08x,%p) thunking to IDirect3DDevice7 interface.\n", This, Centers, Radii, NumSpheres, Flags, ReturnValues);
return IDirect3DDevice7_ComputeSphereVisibility(ICOM_INTERFACE(This, IDirect3DDevice7),
Centers,
Radii,
NumSpheres,
Flags,
ReturnValues);
return IDirect3DDevice7_ComputeSphereVisibility((IDirect3DDevice7 *)This,
Centers, Radii, NumSpheres, Flags, ReturnValues);
}
/*****************************************************************************
......@@ -4862,9 +4743,7 @@ Thunk_IDirect3DDeviceImpl_3_GetTexture(IDirect3DDevice3 *iface,
IDirectDrawSurface7 *ret_val;
TRACE_(ddraw_thunk)("(%p)->(%d,%p) thunking to IDirect3DDevice7 interface.\n", This, Stage, Texture2);
ret = IDirect3DDevice7_GetTexture(ICOM_INTERFACE(This, IDirect3DDevice7),
Stage,
&ret_val);
ret = IDirect3DDevice7_GetTexture((IDirect3DDevice7 *)This, Stage, &ret_val);
*Texture2 = COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirect3DTexture2, ret_val);
......@@ -4947,9 +4826,7 @@ IDirect3DDeviceImpl_3_SetTexture(IDirect3DDevice3 *iface,
if (This->legacyTextureBlending)
IDirect3DDevice3_GetRenderState(iface, D3DRENDERSTATE_TEXTUREMAPBLEND, &texmapblend);
hr = IDirect3DDevice7_SetTexture(ICOM_INTERFACE(This, IDirect3DDevice7),
Stage,
ICOM_INTERFACE(tex, IDirectDrawSurface7));
hr = IDirect3DDevice7_SetTexture((IDirect3DDevice7 *)This, Stage, (IDirectDrawSurface7 *)tex);
if (This->legacyTextureBlending && texmapblend == D3DTBLEND_MODULATE)
{
......@@ -5151,10 +5028,7 @@ Thunk_IDirect3DDeviceImpl_3_GetTextureStageState(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%08x,%p) thunking to IDirect3DDevice7 interface.\n", This, Stage, TexStageStateType, State);
return IDirect3DDevice7_GetTextureStageState(ICOM_INTERFACE(This, IDirect3DDevice7),
Stage,
TexStageStateType,
State);
return IDirect3DDevice7_GetTextureStageState((IDirect3DDevice7 *)This, Stage, TexStageStateType, State);
}
/*****************************************************************************
......@@ -5279,10 +5153,7 @@ Thunk_IDirect3DDeviceImpl_3_SetTextureStageState(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%08x,%08x) thunking to IDirect3DDevice7 interface.\n", This, Stage, TexStageStateType, State);
return IDirect3DDevice7_SetTextureStageState(ICOM_INTERFACE(This, IDirect3DDevice7),
Stage,
TexStageStateType,
State);
return IDirect3DDevice7_SetTextureStageState((IDirect3DDevice7 *)This, Stage, TexStageStateType, State);
}
/*****************************************************************************
......@@ -5344,8 +5215,7 @@ Thunk_IDirect3DDeviceImpl_3_ValidateDevice(IDirect3DDevice3 *iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", This, Passes);
return IDirect3DDevice7_ValidateDevice(ICOM_INTERFACE(This, IDirect3DDevice7),
Passes);
return IDirect3DDevice7_ValidateDevice((IDirect3DDevice7 *)This, Passes);
}
/*****************************************************************************
......@@ -6222,24 +6092,24 @@ static BOOL is_mip_level_subset(IDirectDrawSurfaceImpl *dest,
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL;
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(dest_level, IDirectDrawSurface7), &ddsd.ddsCaps, &temp);
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)dest_level, &ddsd.ddsCaps, &temp);
if (dest_level != dest) IDirectDrawSurface7_Release(ICOM_INTERFACE(dest_level, IDirectDrawSurface7));
if (dest_level != dest) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)dest_level);
dest_level = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, temp);
}
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL;
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(src_level, IDirectDrawSurface7), &ddsd.ddsCaps, &temp);
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)src_level, &ddsd.ddsCaps, &temp);
if (src_level != src) IDirectDrawSurface7_Release(ICOM_INTERFACE(src_level, IDirectDrawSurface7));
if (src_level != src) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)src_level);
src_level = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, temp);
}
if (src_level && src_level != src) IDirectDrawSurface7_Release(ICOM_INTERFACE(src_level, IDirectDrawSurface7));
if (dest_level && dest_level != dest) IDirectDrawSurface7_Release(ICOM_INTERFACE(dest_level, IDirectDrawSurface7));
if (src_level && src_level != src) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)src_level);
if (dest_level && dest_level != dest) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)dest_level);
return !dest_level && levelFound;
}
......@@ -6263,8 +6133,8 @@ static void copy_mipmap_chain(IDirect3DDeviceImpl *device,
BOOL palette_missing = FALSE;
/* Copy palette, if possible. */
IDirectDrawSurface7_GetPalette(ICOM_INTERFACE(src, IDirectDrawSurface7), &pal_src);
IDirectDrawSurface7_GetPalette(ICOM_INTERFACE(dest, IDirectDrawSurface7), &pal);
IDirectDrawSurface7_GetPalette((IDirectDrawSurface7 *)src, &pal_src);
IDirectDrawSurface7_GetPalette((IDirectDrawSurface7 *)dest, &pal);
if (pal_src != NULL && pal != NULL)
{
......@@ -6286,11 +6156,11 @@ static void copy_mipmap_chain(IDirect3DDeviceImpl *device,
/* Copy colorkeys, if present. */
for (ckeyflag = DDCKEY_DESTBLT; ckeyflag <= DDCKEY_SRCOVERLAY; ckeyflag <<= 1)
{
hr = IDirectDrawSurface7_GetColorKey(ICOM_INTERFACE(src, IDirectDrawSurface7), ckeyflag, &ddckey);
hr = IDirectDrawSurface7_GetColorKey((IDirectDrawSurface7 *)src, ckeyflag, &ddckey);
if (SUCCEEDED(hr))
{
IDirectDrawSurface7_SetColorKey(ICOM_INTERFACE(dest, IDirectDrawSurface7), ckeyflag, &ddckey);
IDirectDrawSurface7_SetColorKey((IDirectDrawSurface7 *)dest, ckeyflag, &ddckey);
}
}
......@@ -6322,18 +6192,18 @@ static void copy_mipmap_chain(IDirect3DDeviceImpl *device,
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL;
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(dest_level, IDirectDrawSurface7), &ddsd.ddsCaps, &temp);
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)dest_level, &ddsd.ddsCaps, &temp);
if (dest_level != dest) IDirectDrawSurface7_Release(ICOM_INTERFACE(dest_level, IDirectDrawSurface7));
if (dest_level != dest) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)dest_level);
dest_level = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, temp);
}
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL;
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(src_level, IDirectDrawSurface7), &ddsd.ddsCaps, &temp);
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)src_level, &ddsd.ddsCaps, &temp);
if (src_level != src) IDirectDrawSurface7_Release(ICOM_INTERFACE(src_level, IDirectDrawSurface7));
if (src_level != src) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)src_level);
src_level = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, temp);
......@@ -6346,8 +6216,8 @@ static void copy_mipmap_chain(IDirect3DDeviceImpl *device,
rect.bottom = (rect.bottom + 1) / 2;
}
if (src_level && src_level != src) IDirectDrawSurface7_Release(ICOM_INTERFACE(src_level, IDirectDrawSurface7));
if (dest_level && dest_level != dest) IDirectDrawSurface7_Release(ICOM_INTERFACE(dest_level, IDirectDrawSurface7));
if (src_level && src_level != src) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)src_level);
if (dest_level && dest_level != dest) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)dest_level);
}
/*****************************************************************************
......@@ -6479,15 +6349,15 @@ IDirect3DDeviceImpl_7_Load(IDirect3DDevice7 *iface,
{
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | (src_face_flag << 1);
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(src, IDirectDrawSurface7), &ddsd.ddsCaps, &temp);
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)src, &ddsd.ddsCaps, &temp);
if (src_face != src) IDirectDrawSurface7_Release(ICOM_INTERFACE(src_face, IDirectDrawSurface7));
if (src_face != src) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)src_face);
src_face = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, temp);
}
else
{
if (src_face != src) IDirectDrawSurface7_Release(ICOM_INTERFACE(src_face, IDirectDrawSurface7));
if (src_face != src) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)src_face);
src_face = NULL;
}
......@@ -6497,15 +6367,15 @@ IDirect3DDeviceImpl_7_Load(IDirect3DDevice7 *iface,
{
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | (dest_face_flag << 1);
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(dest, IDirectDrawSurface7), &ddsd.ddsCaps, &temp);
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)dest, &ddsd.ddsCaps, &temp);
if (dest_face != dest) IDirectDrawSurface7_Release(ICOM_INTERFACE(dest_face, IDirectDrawSurface7));
if (dest_face != dest) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)dest_face);
dest_face = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, temp);
}
else
{
if (dest_face != dest) IDirectDrawSurface7_Release(ICOM_INTERFACE(dest_face, IDirectDrawSurface7));
if (dest_face != dest) IDirectDrawSurface7_Release((IDirectDrawSurface7 *)dest_face);
dest_face = NULL;
}
......@@ -7158,9 +7028,7 @@ IDirect3DDeviceImpl_UpdateDepthStencil(IDirect3DDeviceImpl *This)
IDirectDrawSurfaceImpl *dsi;
static DDSCAPS2 depthcaps = { DDSCAPS_ZBUFFER, 0, 0, 0 };
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(This->target, IDirectDrawSurface7),
&depthcaps,
&depthStencil);
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)This->target, &depthcaps, &depthStencil);
if(!depthStencil)
{
TRACE("Setting wined3d depth stencil to NULL\n");
......
......@@ -54,9 +54,7 @@ Thunk_IDirect3DImpl_7_QueryInterface(IDirect3D7 *iface,
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
TRACE("(%p)->(%s,%p): Thunking to IDirectDraw7\n", This, debugstr_guid(refiid), obj);
return IDirectDraw7_QueryInterface(ICOM_INTERFACE(This, IDirectDraw7),
refiid,
obj);
return IDirectDraw7_QueryInterface((IDirectDraw7 *)This, refiid, obj);
}
static HRESULT WINAPI
......@@ -67,9 +65,7 @@ Thunk_IDirect3DImpl_3_QueryInterface(IDirect3D3 *iface,
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
TRACE("(%p)->(%s,%p): Thunking to IDirectDraw7\n", This, debugstr_guid(refiid), obj);
return IDirectDraw7_QueryInterface(ICOM_INTERFACE(This, IDirectDraw7),
refiid,
obj);
return IDirectDraw7_QueryInterface((IDirectDraw7 *)This, refiid, obj);
}
static HRESULT WINAPI
......@@ -80,9 +76,7 @@ Thunk_IDirect3DImpl_2_QueryInterface(IDirect3D2 *iface,
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
TRACE("(%p)->(%s,%p): Thunking to IDirectDraw7\n", This, debugstr_guid(refiid), obj);
return IDirectDraw7_QueryInterface(ICOM_INTERFACE(This, IDirectDraw7),
refiid,
obj);
return IDirectDraw7_QueryInterface((IDirectDraw7 *)This, refiid, obj);
}
static HRESULT WINAPI
......@@ -93,9 +87,7 @@ Thunk_IDirect3DImpl_1_QueryInterface(IDirect3D *iface,
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p)->(%s,%p): Thunking to IDirectDraw7\n", This, debugstr_guid(refiid), obj);
return IDirectDraw7_QueryInterface(ICOM_INTERFACE(This, IDirectDraw7),
refiid,
obj);
return IDirectDraw7_QueryInterface((IDirectDraw7 *)This, refiid, obj);
}
/*****************************************************************************
......@@ -123,7 +115,7 @@ Thunk_IDirect3DImpl_7_AddRef(IDirect3D7 *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
TRACE("(%p) : Thunking to IDirectDraw7.\n", This);
return IDirectDraw7_AddRef(ICOM_INTERFACE(This, IDirectDraw7));
return IDirectDraw7_AddRef((IDirectDraw7 *)This);
}
static ULONG WINAPI
......@@ -132,7 +124,7 @@ Thunk_IDirect3DImpl_3_AddRef(IDirect3D3 *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
TRACE("(%p) : Thunking to IDirectDraw.\n", This);
return IDirectDraw_AddRef(ICOM_INTERFACE(This, IDirectDraw));
return IDirectDraw_AddRef((IDirectDraw *)&This->IDirectDraw_vtbl);
}
static ULONG WINAPI
......@@ -141,7 +133,7 @@ Thunk_IDirect3DImpl_2_AddRef(IDirect3D2 *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
TRACE("(%p) : Thunking to IDirectDraw.\n", This);
return IDirectDraw_AddRef(ICOM_INTERFACE(This, IDirectDraw));
return IDirectDraw_AddRef((IDirectDraw *)&This->IDirectDraw_vtbl);
}
static ULONG WINAPI
......@@ -150,7 +142,7 @@ Thunk_IDirect3DImpl_1_AddRef(IDirect3D *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p) : Thunking to IDirectDraw.\n", This);
return IDirectDraw_AddRef(ICOM_INTERFACE(This, IDirectDraw));
return IDirectDraw_AddRef((IDirectDraw *)&This->IDirectDraw_vtbl);
}
/*****************************************************************************
......@@ -167,7 +159,7 @@ Thunk_IDirect3DImpl_7_Release(IDirect3D7 *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
TRACE("(%p) : Thunking to IDirectDraw7.\n", This);
return IDirectDraw7_Release(ICOM_INTERFACE(This, IDirectDraw7));
return IDirectDraw7_Release((IDirectDraw7 *)This);
}
static ULONG WINAPI
......@@ -176,7 +168,7 @@ Thunk_IDirect3DImpl_3_Release(IDirect3D3 *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
TRACE("(%p) : Thunking to IDirectDraw.\n", This);
return IDirectDraw_Release(ICOM_INTERFACE(This, IDirectDraw));
return IDirectDraw_Release((IDirectDraw *)&This->IDirectDraw_vtbl);
}
static ULONG WINAPI
......@@ -185,7 +177,7 @@ Thunk_IDirect3DImpl_2_Release(IDirect3D2 *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
TRACE("(%p) : Thunking to IDirectDraw.\n", This);
return IDirectDraw_Release(ICOM_INTERFACE(This, IDirectDraw));
return IDirectDraw_Release((IDirectDraw *)&This->IDirectDraw_vtbl);
}
static ULONG WINAPI
......@@ -194,7 +186,7 @@ Thunk_IDirect3DImpl_1_Release(IDirect3D *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p) : Thunking to IDirectDraw.\n", This);
return IDirectDraw_Release(ICOM_INTERFACE(This, IDirectDraw));
return IDirectDraw_Release((IDirectDraw *)&This->IDirectDraw_vtbl);
}
/*****************************************************************************
......@@ -387,9 +379,7 @@ Thunk_IDirect3DImpl_2_EnumDevices(IDirect3D2 *iface,
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Callback, Context);
return IDirect3D3_EnumDevices(ICOM_INTERFACE(This, IDirect3D3),
Callback,
Context);
return IDirect3D3_EnumDevices((IDirect3D3 *)&This->IDirect3D3_vtbl, Callback, Context);
}
static HRESULT WINAPI
......@@ -399,9 +389,7 @@ Thunk_IDirect3DImpl_1_EnumDevices(IDirect3D *iface,
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Callback, Context);
return IDirect3D3_EnumDevices(ICOM_INTERFACE(This, IDirect3D3),
Callback,
Context);
return IDirect3D3_EnumDevices((IDirect3D3 *)&This->IDirect3D3_vtbl, Callback, Context);
}
/*****************************************************************************
......@@ -454,7 +442,7 @@ IDirect3DImpl_3_CreateLight(IDirect3D3 *iface,
object->update = light_desactivate;
object->active_viewport = NULL;
*Light = ICOM_INTERFACE(object, IDirect3DLight);
*Light = (IDirect3DLight *)object;
TRACE("(%p) creating implementation at %p.\n", This, object);
......@@ -468,9 +456,7 @@ Thunk_IDirect3DImpl_2_CreateLight(IDirect3D2 *iface,
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Direct3DLight, UnkOuter);
return IDirect3D3_CreateLight(ICOM_INTERFACE(This, IDirect3D3),
Direct3DLight,
UnkOuter);
return IDirect3D3_CreateLight((IDirect3D3 *)&This->IDirect3D3_vtbl, Direct3DLight, UnkOuter);
}
static HRESULT WINAPI
......@@ -480,9 +466,7 @@ Thunk_IDirect3DImpl_1_CreateLight(IDirect3D *iface,
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Direct3DLight, UnkOuter);
return IDirect3D3_CreateLight(ICOM_INTERFACE(This, IDirect3D3),
Direct3DLight,
UnkOuter);
return IDirect3D3_CreateLight((IDirect3D3 *)&This->IDirect3D3_vtbl, Direct3DLight, UnkOuter);
}
/*****************************************************************************
......@@ -529,7 +513,7 @@ IDirect3DImpl_3_CreateMaterial(IDirect3D3 *iface,
object->ddraw = This;
object->activate = material_activate;
*Material = ICOM_INTERFACE(object, IDirect3DMaterial3);
*Material = (IDirect3DMaterial3 *)object;
TRACE("(%p) creating implementation at %p.\n", This, object);
......@@ -546,9 +530,7 @@ Thunk_IDirect3DImpl_2_CreateMaterial(IDirect3D2 *iface,
IDirect3DMaterial3 *ret_val;
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Direct3DMaterial, UnkOuter);
ret = IDirect3D3_CreateMaterial(ICOM_INTERFACE(This, IDirect3D3),
&ret_val,
UnkOuter);
ret = IDirect3D3_CreateMaterial((IDirect3D3 *)&This->IDirect3D3_vtbl, &ret_val, UnkOuter);
*Direct3DMaterial = COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial3, IDirect3DMaterial2, ret_val);
......@@ -567,9 +549,7 @@ Thunk_IDirect3DImpl_1_CreateMaterial(IDirect3D *iface,
LPDIRECT3DMATERIAL3 ret_val;
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Direct3DMaterial, UnkOuter);
ret = IDirect3D3_CreateMaterial(ICOM_INTERFACE(This, IDirect3D3),
&ret_val,
UnkOuter);
ret = IDirect3D3_CreateMaterial((IDirect3D3 *)&This->IDirect3D3_vtbl, &ret_val, UnkOuter);
*Direct3DMaterial = COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial3, IDirect3DMaterial, ret_val);
......@@ -623,7 +603,7 @@ IDirect3DImpl_3_CreateViewport(IDirect3D3 *iface,
object->num_lights = 0;
object->map_lights = 0;
*Viewport = ICOM_INTERFACE(object, IDirect3DViewport3);
*Viewport = (IDirect3DViewport3 *)object;
TRACE("(%p) creating implementation at %p.\n",This, object);
......@@ -638,7 +618,7 @@ Thunk_IDirect3DImpl_2_CreateViewport(IDirect3D2 *iface,
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, D3DViewport2, UnkOuter);
return IDirect3D3_CreateViewport(ICOM_INTERFACE(This, IDirect3D3),
return IDirect3D3_CreateViewport((IDirect3D3 *)&This->IDirect3D3_vtbl,
(IDirect3DViewport3 **) D3DViewport2 /* No need to cast here */,
UnkOuter);
}
......@@ -651,7 +631,7 @@ Thunk_IDirect3DImpl_1_CreateViewport(IDirect3D *iface,
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, D3DViewport, UnkOuter);
return IDirect3D3_CreateViewport(ICOM_INTERFACE(This, IDirect3D3),
return IDirect3D3_CreateViewport((IDirect3D3 *)&This->IDirect3D3_vtbl,
(IDirect3DViewport3 **) D3DViewport /* No need to cast here */,
UnkOuter);
}
......@@ -723,9 +703,7 @@ Thunk_IDirect3DImpl_2_FindDevice(IDirect3D2 *iface,
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, D3DDFS, D3DFDR);
return IDirect3D3_FindDevice(ICOM_INTERFACE(This, IDirect3D3),
D3DDFS,
D3DFDR);
return IDirect3D3_FindDevice((IDirect3D3 *)&This->IDirect3D3_vtbl, D3DDFS, D3DFDR);
}
static HRESULT WINAPI
......@@ -735,9 +713,7 @@ Thunk_IDirect3DImpl_1_FindDevice(IDirect3D *iface,
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, D3DDFS, D3DDevice);
return IDirect3D3_FindDevice(ICOM_INTERFACE(This, IDirect3D3),
D3DDFS,
D3DDevice);
return IDirect3D3_FindDevice((IDirect3D3 *)&This->IDirect3D3_vtbl, D3DDFS, D3DDevice);
}
/*****************************************************************************
......@@ -852,7 +828,7 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
WINED3DPOOL_DEFAULT,
&object->indexbuffer,
0 /* Handle */,
(IUnknown *) ICOM_INTERFACE(IndexBufferParent, IParent));
(IUnknown *)IndexBufferParent);
if(FAILED(hr))
{
......@@ -869,7 +845,7 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
IWineD3DDevice_AddRef(This->wineD3DDevice);
/* Don't forget to return the interface ;) */
*Device = ICOM_INTERFACE(object, IDirect3DDevice7);
*Device = (IDirect3DDevice7 *)object;
TRACE(" (%p) Created an IDirect3DDeviceImpl object at %p\n", This, object);
......@@ -928,7 +904,7 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
* add another ref which is released when the device is destroyed.
*/
IDirectDrawSurface7_AddRef(Surface);
IDirectDrawSurface7_AddRef(ICOM_INTERFACE(This->d3d_target, IDirectDrawSurface7));
IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)This->d3d_target);
This->d3ddevice = object;
......@@ -953,10 +929,8 @@ Thunk_IDirect3DImpl_3_CreateDevice(IDirect3D3 *iface,
if(UnkOuter != NULL)
return CLASS_E_NOAGGREGATION;
hr = IDirect3D7_CreateDevice(ICOM_INTERFACE(This, IDirect3D7),
refiid,
(IDirectDrawSurface7 *) Surface /* Same VTables */,
(IDirect3DDevice7 **) Device);
hr = IDirect3D7_CreateDevice((IDirect3D7 *)&This->IDirect3D7_vtbl, refiid,
(IDirectDrawSurface7 *)Surface /* Same VTables */, (IDirect3DDevice7 **)Device);
*Device = COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice7, IDirect3DDevice3, *Device);
return hr;
......@@ -972,10 +946,9 @@ Thunk_IDirect3DImpl_2_CreateDevice(IDirect3D2 *iface,
HRESULT hr;
TRACE("(%p)->(%s,%p,%p): Thunking to IDirect3D7\n", This, debugstr_guid(refiid), Surface, Device);
hr = IDirect3D7_CreateDevice(ICOM_INTERFACE(This, IDirect3D7),
refiid,
COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface3, IDirectDrawSurface7, Surface),
(IDirect3DDevice7 **) Device);
hr = IDirect3D7_CreateDevice((IDirect3D7 *)&This->IDirect3D7_vtbl, refiid,
COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface3, IDirectDrawSurface7, Surface),
(IDirect3DDevice7 **)Device);
*Device = COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice7, IDirect3DDevice2, *Device);
return hr;
......@@ -1056,7 +1029,7 @@ IDirect3DImpl_7_CreateVertexBuffer(IDirect3D7 *iface,
Desc->dwCaps & D3DVBCAPS_SYSTEMMEMORY ? WINED3DPOOL_SYSTEMMEM : WINED3DPOOL_DEFAULT,
&object->wineD3DVertexBuffer,
0 /* SharedHandle */,
(IUnknown *) ICOM_INTERFACE(object, IDirect3DVertexBuffer7));
(IUnknown *)object);
if(hr != D3D_OK)
{
ERR("(%p) IWineD3DDevice::CreateVertexBuffer failed with hr=%08x\n", This, hr);
......@@ -1081,7 +1054,7 @@ IDirect3DImpl_7_CreateVertexBuffer(IDirect3D7 *iface,
IWineD3DVertexDeclaration_AddRef(object->wineD3DVertexDeclaration);
/* Return the interface */
*VertexBuffer = ICOM_INTERFACE(object, IDirect3DVertexBuffer7);
*VertexBuffer = (IDirect3DVertexBuffer7 *)object;
TRACE("(%p) Created new vertex buffer implementation at %p, returning interface at %p\n", This, object, *VertexBuffer);
LeaveCriticalSection(&ddraw_cs);
......@@ -1101,10 +1074,8 @@ Thunk_IDirect3DImpl_3_CreateVertexBuffer(IDirect3D3 *iface,
if(UnkOuter != NULL) return CLASS_E_NOAGGREGATION;
hr = IDirect3D7_CreateVertexBuffer(ICOM_INTERFACE(This, IDirect3D7),
Desc,
(IDirect3DVertexBuffer7 **) VertexBuffer,
Flags);
hr = IDirect3D7_CreateVertexBuffer((IDirect3D7 *)&This->IDirect3D7_vtbl,
Desc, (IDirect3DVertexBuffer7 **)VertexBuffer, Flags);
*VertexBuffer = COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, IDirect3DVertexBuffer, *VertexBuffer);
return hr;
......@@ -1237,10 +1208,7 @@ Thunk_IDirect3DImpl_3_EnumZBufferFormats(IDirect3D3 *iface,
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
TRACE("(%p)->(%s,%p,%p) thunking to IDirect3D7 interface.\n", This, debugstr_guid(riidDevice), Callback, Context);
return IDirect3D7_EnumZBufferFormats(ICOM_INTERFACE(This, IDirect3D7),
riidDevice,
Callback,
Context);
return IDirect3D7_EnumZBufferFormats((IDirect3D7 *)&This->IDirect3D7_vtbl, riidDevice, Callback, Context);
}
/*****************************************************************************
......@@ -1274,7 +1242,7 @@ Thunk_IDirect3DImpl_3_EvictManagedTextures(IDirect3D3 *iface)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", This);
return IDirect3D7_EvictManagedTextures(ICOM_INTERFACE(This, IDirect3D7));
return IDirect3D7_EvictManagedTextures((IDirect3D7 *)&This->IDirect3D7_vtbl);
}
/*****************************************************************************
......
......@@ -175,8 +175,8 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
IWineD3DDevice_SetRenderState(lpDevice->wineD3DDevice,
WINED3DRS_COLORKEYENABLE,
1);
IDirect3DDevice7_DrawIndexedPrimitive(ICOM_INTERFACE(lpDevice,IDirect3DDevice7),
D3DPT_TRIANGLELIST,D3DFVF_TLVERTEX,tl_vx,0,This->indices,count*3,0);
IDirect3DDevice7_DrawIndexedPrimitive((IDirect3DDevice7 *)lpDevice,
D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, tl_vx, 0, This->indices, count * 3, 0);
} break;
case D3DOP_MATRIXLOAD:
......@@ -233,8 +233,8 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
lpDevice->view = ci->u2.dwArg[0];
if(ci->u1.drstRenderStateType == D3DTRANSFORMSTATE_PROJECTION)
lpDevice->proj = ci->u2.dwArg[0];
IDirect3DDevice7_SetTransform(ICOM_INTERFACE(lpDevice, IDirect3DDevice7),
ci->u1.drstRenderStateType, (LPD3DMATRIX) lpDevice->Handles[ci->u2.dwArg[0] - 1].ptr);
IDirect3DDevice7_SetTransform((IDirect3DDevice7 *)lpDevice,
ci->u1.drstRenderStateType, (LPD3DMATRIX)lpDevice->Handles[ci->u2.dwArg[0] - 1].ptr);
}
instr += size;
}
......@@ -303,8 +303,7 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
break;
}
IDirect3DDevice7_SetRenderState(ICOM_INTERFACE(lpDevice, IDirect3DDevice7), rs,
ci->u2.dwArg[0]);
IDirect3DDevice7_SetRenderState((IDirect3DDevice7 *)lpDevice, rs, ci->u2.dwArg[0]);
}
instr += size;
......@@ -313,13 +312,13 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
case D3DOP_STATERENDER: {
int i;
IDirect3DDevice2 *d3d_device2 = (IDirect3DDevice2 *)&lpDevice->IDirect3DDevice2_vtbl;
TRACE("STATERENDER (%d)\n", count);
for (i = 0; i < count; i++) {
LPD3DSTATE ci = (LPD3DSTATE) instr;
IDirect3DDevice2_SetRenderState(ICOM_INTERFACE(lpDevice, IDirect3DDevice2),
ci->u1.drstRenderStateType, ci->u2.dwArg[0]);
IDirect3DDevice2_SetRenderState(d3d_device2, ci->u1.drstRenderStateType, ci->u2.dwArg[0]);
instr += size;
}
......@@ -592,24 +591,23 @@ IDirect3DExecuteBufferImpl_QueryInterface(IDirect3DExecuteBuffer *iface,
REFIID riid,
void **obj)
{
ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface);
TRACE("(%p/%p)->(%s,%p)\n", This, iface, debugstr_guid(riid), obj);
TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), obj);
*obj = NULL;
if ( IsEqualGUID( &IID_IUnknown, riid ) ) {
IDirect3DExecuteBuffer_AddRef(ICOM_INTERFACE(This, IDirect3DExecuteBuffer));
IDirect3DExecuteBuffer_AddRef(iface);
*obj = iface;
TRACE(" Creating IUnknown interface at %p.\n", *obj);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3DExecuteBuffer, riid ) ) {
IDirect3DExecuteBuffer_AddRef(ICOM_INTERFACE(This, IDirect3DExecuteBuffer));
*obj = ICOM_INTERFACE(This, IDirect3DExecuteBuffer);
IDirect3DExecuteBuffer_AddRef(iface);
*obj = iface;
TRACE(" Creating IDirect3DExecuteBuffer interface %p\n", *obj);
return S_OK;
}
FIXME("(%p): interface for IID %s NOT found!\n", This, debugstr_guid(riid));
FIXME("(%p): interface for IID %s NOT found!\n", iface, debugstr_guid(riid));
return E_NOINTERFACE;
}
......
......@@ -67,9 +67,7 @@ IDirectDrawGammaControlImpl_QueryInterface(IDirectDrawGammaControl *iface, REFII
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawGammaControl, iface);
TRACE_(ddraw_thunk)("(%p)->(%s,%p): Thunking to IDirectDrawSurface7\n", This, debugstr_guid(riid), obj);
return IDirectDrawSurface7_QueryInterface(ICOM_INTERFACE(This, IDirectDrawSurface7),
riid,
obj);
return IDirectDrawSurface7_QueryInterface((IDirectDrawSurface7 *)This, riid, obj);
}
/**********************************************************
......@@ -87,7 +85,7 @@ IDirectDrawGammaControlImpl_AddRef(IDirectDrawGammaControl *iface)
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawGammaControl, iface);
TRACE_(ddraw_thunk)("(%p)->() Thunking to IDirectDrawSurface7\n", This);
return IDirectDrawSurface7_AddRef(ICOM_INTERFACE(This, IDirectDrawSurface7));
return IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)This);
}
/**********************************************************
......@@ -105,7 +103,7 @@ IDirectDrawGammaControlImpl_Release(IDirectDrawGammaControl *iface)
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawGammaControl, iface);
TRACE_(ddraw_thunk)("(%p)->() Thunking to IDirectDrawSurface7\n", This);
return IDirectDrawSurface7_Release(ICOM_INTERFACE(This, IDirectDrawSurface7));
return IDirectDrawSurface7_Release((IDirectDrawSurface7 *)This);
}
/**********************************************************
......
......@@ -256,7 +256,7 @@ void light_update(IDirect3DLightImpl* This)
return;
device = This->active_viewport->active_device;
IDirect3DDevice7_SetLight(ICOM_INTERFACE(device,IDirect3DDevice7), This->dwLightIndex, &(This->light7));
IDirect3DDevice7_SetLight((IDirect3DDevice7 *)device, This->dwLightIndex, &(This->light7));
}
/*****************************************************************************
......@@ -278,7 +278,7 @@ void light_activate(IDirect3DLightImpl* This)
light_update(This);
/* If was not active, activate it */
if ((This->light.dwFlags & D3DLIGHT_ACTIVE) == 0) {
IDirect3DDevice7_LightEnable(ICOM_INTERFACE(device,IDirect3DDevice7), This->dwLightIndex, TRUE);
IDirect3DDevice7_LightEnable((IDirect3DDevice7 *)device, This->dwLightIndex, TRUE);
This->light.dwFlags |= D3DLIGHT_ACTIVE;
}
}
......@@ -302,7 +302,7 @@ void light_desactivate(IDirect3DLightImpl* This)
/* If was not active, activate it */
if ((This->light.dwFlags & D3DLIGHT_ACTIVE) != 0) {
IDirect3DDevice7_LightEnable(ICOM_INTERFACE(device,IDirect3DDevice7), This->dwLightIndex, FALSE);
IDirect3DDevice7_LightEnable((IDirect3DDevice7 *)device, This->dwLightIndex, FALSE);
This->light.dwFlags &= ~D3DLIGHT_ACTIVE;
}
}
......
......@@ -233,8 +233,7 @@ DDRAW_Create(const GUID *guid,
* initialized
*/
hr = IWineD3D_CreateDevice(wineD3D, 0 /* D3D_ADAPTER_DEFAULT */, devicetype, NULL /* FocusWindow, don't know yet */,
0 /* BehaviorFlags */, (IUnknown *)ICOM_INTERFACE(This, IDirectDraw7),
(IWineD3DDeviceParent *)&This->device_parent_vtbl, &wineD3DDevice);
0 /* BehaviorFlags */, (IUnknown *)This, (IWineD3DDeviceParent *)&This->device_parent_vtbl, &wineD3DDevice);
if(FAILED(hr))
{
ERR("Failed to create a wineD3DDevice, result = %x\n", hr);
......@@ -283,7 +282,7 @@ DDRAW_Create(const GUID *guid,
/* Call QueryInterface to get the pointer to the requested interface. This also initializes
* The required refcount
*/
hr = IDirectDraw7_QueryInterface( ICOM_INTERFACE(This, IDirectDraw7), iid, DD);
hr = IDirectDraw7_QueryInterface((IDirectDraw7 *)This, iid, DD);
if(SUCCEEDED(hr)) return DD_OK;
err_out:
......@@ -705,7 +704,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
*ppv = ICOM_INTERFACE(factory, IClassFactory);
*ppv = factory;
return S_OK;
}
......@@ -899,11 +898,11 @@ DllMain(HINSTANCE hInstDLL,
WARN("DDraw %p has a refcount of %d\n", ddraw, ddraw->ref7 + ddraw->ref4 + ddraw->ref3 + ddraw->ref2 + ddraw->ref1);
/* Add references to each interface to avoid freeing them unexpectedly */
IDirectDraw_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw));
IDirectDraw2_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw2));
IDirectDraw3_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw3));
IDirectDraw4_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw4));
IDirectDraw7_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw7));
IDirectDraw_AddRef((IDirectDraw *)&ddraw->IDirectDraw_vtbl);
IDirectDraw2_AddRef((IDirectDraw2 *)&ddraw->IDirectDraw2_vtbl);
IDirectDraw3_AddRef((IDirectDraw3 *)&ddraw->IDirectDraw3_vtbl);
IDirectDraw4_AddRef((IDirectDraw4 *)&ddraw->IDirectDraw4_vtbl);
IDirectDraw7_AddRef((IDirectDraw7 *)ddraw);
/* Does a D3D device exist? Destroy it
* TODO: Destroy all Vertex buffers, Lights, Materials
......@@ -912,7 +911,7 @@ DllMain(HINSTANCE hInstDLL,
if(ddraw->d3ddevice)
{
WARN("DDraw %p has d3ddevice %p attached\n", ddraw, ddraw->d3ddevice);
while(IDirect3DDevice7_Release(ICOM_INTERFACE(ddraw->d3ddevice, IDirect3DDevice7)));
while(IDirect3DDevice7_Release((IDirect3DDevice7 *)ddraw->d3ddevice));
}
/* Try to release the objects
......@@ -922,11 +921,8 @@ DllMain(HINSTANCE hInstDLL,
desc.dwSize = sizeof(desc);
for(i = 0; i <= 1; i++)
{
hr = IDirectDraw7_EnumSurfaces(ICOM_INTERFACE(ddraw, IDirectDraw7),
DDENUMSURFACES_ALL,
&desc,
ddraw,
DestroyCallback);
hr = IDirectDraw7_EnumSurfaces((IDirectDraw7 *)ddraw,
DDENUMSURFACES_ALL, &desc, ddraw, DestroyCallback);
if(hr != D3D_OK)
ERR("(%p) EnumSurfaces failed, prepare for trouble\n", ddraw);
}
......@@ -938,11 +934,11 @@ DllMain(HINSTANCE hInstDLL,
/* Release all hanging references to destroy the objects. This
* restores the screen mode too
*/
while(IDirectDraw_Release(ICOM_INTERFACE(ddraw, IDirectDraw)));
while(IDirectDraw2_Release(ICOM_INTERFACE(ddraw, IDirectDraw2)));
while(IDirectDraw3_Release(ICOM_INTERFACE(ddraw, IDirectDraw3)));
while(IDirectDraw4_Release(ICOM_INTERFACE(ddraw, IDirectDraw4)));
while(IDirectDraw7_Release(ICOM_INTERFACE(ddraw, IDirectDraw7)));
while(IDirectDraw_Release((IDirectDraw *)&ddraw->IDirectDraw_vtbl));
while(IDirectDraw2_Release((IDirectDraw2 *)&ddraw->IDirectDraw2_vtbl));
while(IDirectDraw3_Release((IDirectDraw3 *)&ddraw->IDirectDraw3_vtbl));
while(IDirectDraw4_Release((IDirectDraw4 *)&ddraw->IDirectDraw4_vtbl));
while(IDirectDraw7_Release((IDirectDraw7 *)ddraw));
}
}
}
......
......@@ -80,26 +80,26 @@ IDirect3DMaterialImpl_QueryInterface(IDirect3DMaterial3 *iface,
*obp = NULL;
if ( IsEqualGUID( &IID_IUnknown, riid ) ) {
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial));
IUnknown_AddRef(iface);
*obp = iface;
TRACE(" Creating IUnknown interface at %p.\n", *obp);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3DMaterial, riid ) ) {
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial));
*obp = ICOM_INTERFACE(This, IDirect3DMaterial);
IDirect3DMaterial_AddRef((IDirect3DMaterial *)&This->IDirect3DMaterial_vtbl);
*obp = &This->IDirect3DMaterial_vtbl;
TRACE(" Creating IDirect3DMaterial interface %p\n", *obp);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3DMaterial2, riid ) ) {
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial));
*obp = ICOM_INTERFACE(This, IDirect3DMaterial2);
IDirect3DMaterial_AddRef((IDirect3DMaterial2 *)&This->IDirect3DMaterial2_vtbl);
*obp = &This->IDirect3DMaterial2_vtbl;
TRACE(" Creating IDirect3DMaterial2 interface %p\n", *obp);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3DMaterial3, riid ) ) {
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial));
*obp = ICOM_INTERFACE(This, IDirect3DMaterial3);
IDirect3DMaterial_AddRef((IDirect3DMaterial2 *)&This->IDirect3DMaterial3_vtbl);
*obp = &This->IDirect3DMaterial3_vtbl;
TRACE(" Creating IDirect3DMaterial3 interface %p\n", *obp);
return S_OK;
}
......@@ -465,8 +465,7 @@ void material_activate(IDirect3DMaterialImpl* This)
d3d7mat.u3.emissive = This->mat.u3.emissive;
d3d7mat.u4.power = This->mat.u4.power;
IDirect3DDevice7_SetMaterial(ICOM_INTERFACE(This->active_device, IDirect3DDevice7),
&d3d7mat);
IDirect3DDevice7_SetMaterial((IDirect3DDevice7 *)This->active_device, &d3d7mat);
}
const IDirect3DMaterial3Vtbl IDirect3DMaterial3_Vtbl =
......
......@@ -68,15 +68,14 @@ IParentImpl_QueryInterface(IParent *iface,
REFIID riid,
void **obj)
{
ICOM_THIS_FROM(IParentImpl, IParent, iface);
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), obj);
TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), obj);
*obj = NULL;
if ( IsEqualGUID( &IID_IUnknown, riid ) ||
IsEqualGUID( &IID_IParent, riid ) )
{
*obj = ICOM_INTERFACE(This, IParent);
IParent_AddRef(ICOM_INTERFACE(This, IParent));
*obj = iface;
IParent_AddRef(iface);
return DD_OK;
}
return E_NOINTERFACE;
......
......@@ -89,7 +89,7 @@ IDirectDrawSurfaceImpl_QueryInterface(IDirectDrawSurface7 *iface,
|| IsEqualGUID(riid, &IID_IDirectDrawSurface4) )
{
IUnknown_AddRef(iface);
*obj = ICOM_INTERFACE(This, IDirectDrawSurface7);
*obj = iface;
TRACE("(%p) returning IDirectDrawSurface7 interface at %p\n", This, *obj);
return S_OK;
}
......@@ -98,14 +98,14 @@ IDirectDrawSurfaceImpl_QueryInterface(IDirectDrawSurface7 *iface,
|| IsEqualGUID(riid, &IID_IDirectDrawSurface) )
{
IUnknown_AddRef(iface);
*obj = ICOM_INTERFACE(This, IDirectDrawSurface3);
*obj = &This->IDirectDrawSurface3_vtbl;
TRACE("(%p) returning IDirectDrawSurface3 interface at %p\n", This, *obj);
return S_OK;
}
else if( IsEqualGUID(riid, &IID_IDirectDrawGammaControl) )
{
IUnknown_AddRef(iface);
*obj = ICOM_INTERFACE(This, IDirectDrawGammaControl);
*obj = &This->IDirectDrawGammaControl_vtbl;
TRACE("(%p) returning IDirectDrawGammaControl interface at %p\n", This, *obj);
return S_OK;
}
......@@ -116,10 +116,7 @@ IDirectDrawSurfaceImpl_QueryInterface(IDirectDrawSurface7 *iface,
IDirect3DDevice7 *d3d;
/* Call into IDirect3D7 for creation */
IDirect3D7_CreateDevice(ICOM_INTERFACE(This->ddraw, IDirect3D7),
riid,
ICOM_INTERFACE(This, IDirectDrawSurface7),
&d3d);
IDirect3D7_CreateDevice((IDirect3D7 *)&This->ddraw->IDirect3D7_vtbl, riid, (IDirectDrawSurface7 *)This, &d3d);
*obj = COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice7, IDirect3DDevice, d3d);
TRACE("(%p) Returning IDirect3DDevice interface at %p\n", This, *obj);
......@@ -131,12 +128,12 @@ IDirectDrawSurfaceImpl_QueryInterface(IDirectDrawSurface7 *iface,
{
if (IsEqualGUID( &IID_IDirect3DTexture, riid ))
{
*obj = ICOM_INTERFACE(This, IDirect3DTexture);
*obj = &This->IDirect3DTexture_vtbl;
TRACE(" returning Direct3DTexture interface at %p.\n", *obj);
}
else
{
*obj = ICOM_INTERFACE(This, IDirect3DTexture2);
*obj = &This->IDirect3DTexture2_vtbl;
TRACE(" returning Direct3DTexture2 interface at %p.\n", *obj);
}
IUnknown_AddRef( (IUnknown *) *obj);
......@@ -200,8 +197,8 @@ void IDirectDrawSurfaceImpl_Destroy(IDirectDrawSurfaceImpl *This)
* is called, because the refcount is held. It looks like the app released()
* it often enough to force this
*/
IDirectDrawSurface7 *root = ICOM_INTERFACE(This->first_attached, IDirectDrawSurface7);
IDirectDrawSurface7 *detach = ICOM_INTERFACE(This, IDirectDrawSurface7);
IDirectDrawSurface7 *root = (IDirectDrawSurface7 *)This->first_attached;
IDirectDrawSurface7 *detach = (IDirectDrawSurface7 *)This;
FIXME("(%p) Freeing a surface that is attached to surface %p\n", This, This->first_attached);
......@@ -214,8 +211,8 @@ void IDirectDrawSurfaceImpl_Destroy(IDirectDrawSurfaceImpl *This)
while(This->next_attached != NULL)
{
IDirectDrawSurface7 *root = ICOM_INTERFACE(This, IDirectDrawSurface7);
IDirectDrawSurface7 *detach = ICOM_INTERFACE(This->next_attached, IDirectDrawSurface7);
IDirectDrawSurface7 *root = (IDirectDrawSurface7 *)This;
IDirectDrawSurface7 *detach = (IDirectDrawSurface7 *)This->next_attached;
if(IDirectDrawSurface7_DeleteAttachedSurface(root, 0, detach) != DD_OK)
{
......@@ -400,8 +397,7 @@ IDirectDrawSurfaceImpl_Release(IDirectDrawSurface7 *iface)
}
/* The refcount test shows that the palette is detached when the surface is destroyed */
IDirectDrawSurface7_SetPalette(ICOM_INTERFACE(This, IDirectDrawSurface7),
NULL);
IDirectDrawSurface7_SetPalette((IDirectDrawSurface7 *)This, NULL);
/* Loop through all complex attached surfaces,
* and destroy them.
......@@ -515,7 +511,7 @@ IDirectDrawSurfaceImpl_GetAttachedSurface(IDirectDrawSurface7 *iface,
TRACE("(%p): Returning surface %p\n", This, surf);
TRACE("(%p): mipmapcount=%d\n", This, surf->mipmap_level);
*Surface = ICOM_INTERFACE(surf, IDirectDrawSurface7);
*Surface = (IDirectDrawSurface7 *)surf;
IDirectDrawSurface7_AddRef(*Surface);
LeaveCriticalSection(&ddraw_cs);
return DD_OK;
......@@ -540,7 +536,7 @@ IDirectDrawSurfaceImpl_GetAttachedSurface(IDirectDrawSurface7 *iface,
((surf->surface_desc.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2)) {
TRACE("(%p): Returning surface %p\n", This, surf);
*Surface = ICOM_INTERFACE(surf, IDirectDrawSurface7);
*Surface = (IDirectDrawSurface7 *)surf;
IDirectDrawSurface7_AddRef(*Surface);
LeaveCriticalSection(&ddraw_cs);
return DD_OK;
......@@ -927,7 +923,7 @@ IDirectDrawSurfaceImpl_AddAttachedSurface(IDirectDrawSurfaceImpl *This,
/* MSDN:
* "This method increments the reference count of the surface being attached."
*/
IDirectDrawSurface7_AddRef(ICOM_INTERFACE(Surf, IDirectDrawSurface7));
IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)Surf);
LeaveCriticalSection(&ddraw_cs);
return DD_OK;
}
......@@ -1397,10 +1393,10 @@ IDirectDrawSurfaceImpl_EnumAttachedSurfaces(IDirectDrawSurface7 *iface,
surf = This->complex_array[i];
if(!surf) break;
IDirectDrawSurface7_AddRef(ICOM_INTERFACE(surf, IDirectDrawSurface7));
IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)surf);
desc = surf->surface_desc;
/* check: != DDENUMRET_OK or == DDENUMRET_CANCEL? */
if (cb(ICOM_INTERFACE(surf, IDirectDrawSurface7), &desc, context) == DDENUMRET_CANCEL)
if (cb((IDirectDrawSurface7 *)surf, &desc, context) == DDENUMRET_CANCEL)
{
LeaveCriticalSection(&ddraw_cs);
return DD_OK;
......@@ -1409,10 +1405,10 @@ IDirectDrawSurfaceImpl_EnumAttachedSurfaces(IDirectDrawSurface7 *iface,
for (surf = This->next_attached; surf != NULL; surf = surf->next_attached)
{
IDirectDrawSurface7_AddRef(ICOM_INTERFACE(surf, IDirectDrawSurface7));
IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)surf);
desc = surf->surface_desc;
/* check: != DDENUMRET_OK or == DDENUMRET_CANCEL? */
if (cb( ICOM_INTERFACE(surf, IDirectDrawSurface7), &desc, context) == DDENUMRET_CANCEL)
if (cb((IDirectDrawSurface7 *)surf, &desc, context) == DDENUMRET_CANCEL)
{
LeaveCriticalSection(&ddraw_cs);
return DD_OK;
......@@ -1938,26 +1934,23 @@ IDirectDrawSurfaceImpl_GetDDInterface(IDirectDrawSurface7 *iface,
switch(This->version)
{
case 7:
*((IDirectDraw7 **) DD) = ICOM_INTERFACE(This->ddraw, IDirectDraw7);
IDirectDraw7_AddRef(*(IDirectDraw7 **) DD);
*DD = This->ddraw;
break;
case 4:
*((IDirectDraw4 **) DD) = ICOM_INTERFACE(This->ddraw, IDirectDraw4);
IDirectDraw4_AddRef(*(IDirectDraw4 **) DD);
*DD = &This->ddraw->IDirectDraw4_vtbl;
break;
case 2:
*((IDirectDraw2 **) DD) = ICOM_INTERFACE(This->ddraw, IDirectDraw2);
IDirectDraw_AddRef( *(IDirectDraw2 **) DD);
*DD = &This->ddraw->IDirectDraw2_vtbl;
break;
case 1:
*((IDirectDraw **) DD) = ICOM_INTERFACE(This->ddraw, IDirectDraw);
IDirectDraw_AddRef( *(IDirectDraw **) DD);
*DD = &This->ddraw->IDirectDraw_vtbl;
break;
}
IUnknown_AddRef((IUnknown *)*DD);
return DD_OK;
}
......@@ -2189,7 +2182,7 @@ IDirectDrawSurfaceImpl_GetClipper(IDirectDrawSurface7 *iface,
return DDERR_NOCLIPPERATTACHED;
}
*Clipper = ICOM_INTERFACE(This->clipper, IDirectDrawClipper);
*Clipper = (IDirectDrawClipper *)This->clipper;
IDirectDrawClipper_AddRef(*Clipper);
LeaveCriticalSection(&ddraw_cs);
return DD_OK;
......@@ -2229,7 +2222,7 @@ IDirectDrawSurfaceImpl_SetClipper(IDirectDrawSurface7 *iface,
if (Clipper != NULL)
IDirectDrawClipper_AddRef(Clipper);
if(oldClipper)
IDirectDrawClipper_Release(ICOM_INTERFACE(oldClipper, IDirectDrawClipper));
IDirectDrawClipper_Release((IDirectDrawClipper *)oldClipper);
hr = IWineD3DSurface_SetClipper(This->WineD3DSurface, This->clipper ? This->clipper->wineD3DClipper : NULL);
......@@ -2591,8 +2584,7 @@ IDirectDrawSurfaceImpl_SetPalette(IDirectDrawSurface7 *iface,
{
IDirectDrawSurface7 *attach;
HRESULT hr;
hr = IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(surf, IDirectDrawSurface7),
&caps2, &attach);
hr = IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)surf, &caps2, &attach);
if(hr != DD_OK)
{
break;
......
......@@ -55,9 +55,7 @@ Thunk_IDirect3DTextureImpl_2_QueryInterface(IDirect3DTexture2 *iface,
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface);
TRACE("(%p)->(%s,%p) thunking to IDirectDrawSurface7 interface.\n", This, debugstr_guid(riid), obj);
return IDirectDrawSurface7_QueryInterface(ICOM_INTERFACE(This, IDirectDrawSurface7),
riid,
obj);
return IDirectDrawSurface7_QueryInterface((IDirectDrawSurface7 *)This, riid, obj);
}
static HRESULT WINAPI
......@@ -68,9 +66,7 @@ Thunk_IDirect3DTextureImpl_1_QueryInterface(IDirect3DTexture *iface,
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture, iface);
TRACE("(%p)->(%s,%p) thunking to IDirectDrawSurface7 interface.\n", This, debugstr_guid(riid), obj);
return IDirectDrawSurface7_QueryInterface(ICOM_INTERFACE(This, IDirectDrawSurface7),
riid,
obj);
return IDirectDrawSurface7_QueryInterface((IDirectDrawSurface7 *)This, riid, obj);
}
static ULONG WINAPI
......@@ -79,7 +75,7 @@ Thunk_IDirect3DTextureImpl_2_AddRef(IDirect3DTexture2 *iface)
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface);
TRACE("(%p)->() thunking to IDirectDrawSurface7 interface.\n", This);
return IDirectDrawSurface7_AddRef(ICOM_INTERFACE(This, IDirectDrawSurface7));
return IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)This);
}
static ULONG WINAPI
......@@ -97,7 +93,7 @@ Thunk_IDirect3DTextureImpl_2_Release(IDirect3DTexture2 *iface)
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface);
TRACE("(%p)->() thunking to IDirectDrawSurface7 interface.\n", This);
return IDirectDrawSurface7_Release(ICOM_INTERFACE(This, IDirectDrawSurface7));
return IDirectDrawSurface7_Release((IDirectDrawSurface7 *)This);
}
......@@ -242,11 +238,12 @@ Thunk_IDirect3DTextureImpl_1_GetHandle(IDirect3DTexture *iface,
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture, iface);
IDirect3DDeviceImpl *d3d = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice, lpDirect3DDevice);
IDirect3DTexture2 *d3d_texture2 = (IDirect3DTexture2 *)&This->IDirect3DTexture2_vtbl;
IDirect3DDevice2 *d3d_device2 = (IDirect3DDevice2 *)&d3d->IDirect3DDevice2_vtbl;
TRACE_(ddraw_thunk)("(%p)->(%p,%p) thunking to IDirect3DTexture2 interface.\n", This, d3d, lpHandle);
return IDirect3DTexture2_GetHandle(ICOM_INTERFACE(This, IDirect3DTexture2),
ICOM_INTERFACE(d3d, IDirect3DDevice2),
lpHandle);
return IDirect3DTexture2_GetHandle(d3d_texture2, d3d_device2, lpHandle);
}
......@@ -267,8 +264,7 @@ get_sub_mimaplevel(IDirectDrawSurfaceImpl *tex_ptr)
IDirectDrawSurfaceImpl *surf_ptr;
HRESULT hr;
hr = IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(tex_ptr, IDirectDrawSurface7),
&mipmap_caps, &next_level);
hr = IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)tex_ptr, &mipmap_caps, &next_level);
if (FAILED(hr)) return NULL;
surf_ptr = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, next_level);
......
......@@ -77,22 +77,22 @@ IDirect3DVertexBufferImpl_QueryInterface(IDirect3DVertexBuffer7 *iface,
if ( IsEqualGUID( &IID_IUnknown, riid ) )
{
IDirect3DVertexBuffer7_AddRef(ICOM_INTERFACE(This,IDirect3DVertexBuffer7));
IUnknown_AddRef(iface);
*obj = iface;
TRACE(" Creating IUnknown interface at %p.\n", *obj);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3DVertexBuffer, riid ) )
{
IDirect3DVertexBuffer7_AddRef(ICOM_INTERFACE(This,IDirect3DVertexBuffer7));
*obj = ICOM_INTERFACE(This, IDirect3DVertexBuffer);
IUnknown_AddRef(iface);
*obj = &This->IDirect3DVertexBuffer_vtbl;
TRACE(" Creating IDirect3DVertexBuffer interface %p\n", *obj);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3DVertexBuffer7, riid ) )
{
IDirect3DVertexBuffer7_AddRef(ICOM_INTERFACE(This,IDirect3DVertexBuffer7));
*obj = ICOM_INTERFACE(This, IDirect3DVertexBuffer7);
IUnknown_AddRef(iface);
*obj = iface;
TRACE(" Creating IDirect3DVertexBuffer7 interface %p\n", *obj);
return S_OK;
}
......@@ -108,9 +108,7 @@ Thunk_IDirect3DVertexBufferImpl_1_QueryInterface(IDirect3DVertexBuffer *iface,
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
TRACE_(ddraw_thunk)("(%p)->(%s,%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, debugstr_guid(riid), obj);
return IDirect3DVertexBuffer7_QueryInterface(ICOM_INTERFACE(This, IDirect3DVertexBuffer7),
riid,
obj);
return IDirect3DVertexBuffer7_QueryInterface((IDirect3DVertexBuffer7 *)This, riid, obj);
}
/*****************************************************************************
......@@ -139,7 +137,7 @@ Thunk_IDirect3DVertexBufferImpl_1_AddRef(IDirect3DVertexBuffer *iface)
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", This);
return IDirect3DVertexBuffer7_AddRef(ICOM_INTERFACE(This, IDirect3DVertexBuffer7));
return IDirect3DVertexBuffer7_AddRef((IDirect3DVertexBuffer7 *)This);
}
......@@ -204,7 +202,7 @@ Thunk_IDirect3DVertexBufferImpl_1_Release(IDirect3DVertexBuffer *iface)
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", This);
return IDirect3DVertexBuffer7_Release(ICOM_INTERFACE(This, IDirect3DVertexBuffer7));
return IDirect3DVertexBuffer7_Release((IDirect3DVertexBuffer7 *)This);
}
/*****************************************************************************
......@@ -274,10 +272,7 @@ Thunk_IDirect3DVertexBufferImpl_1_Lock(IDirect3DVertexBuffer *iface,
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%p,%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, Flags, Data, Size);
return IDirect3DVertexBuffer7_Lock(ICOM_INTERFACE(This, IDirect3DVertexBuffer7),
Flags,
Data,
Size);
return IDirect3DVertexBuffer7_Lock((IDirect3DVertexBuffer7 *)This, Flags, Data, Size);
}
/*****************************************************************************
......@@ -309,7 +304,7 @@ Thunk_IDirect3DVertexBufferImpl_1_Unlock(IDirect3DVertexBuffer *iface)
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", This);
return IDirect3DVertexBuffer7_Unlock(ICOM_INTERFACE(This, IDirect3DVertexBuffer7));
return IDirect3DVertexBuffer7_Unlock((IDirect3DVertexBuffer7 *)This);
}
......@@ -424,14 +419,8 @@ Thunk_IDirect3DVertexBufferImpl_1_ProcessVertices(IDirect3DVertexBuffer *iface,
TRACE_(ddraw_thunk)("(%p)->(%08x,%08x,%08x,%p,%08x,%p,%08x) thunking to IDirect3DVertexBuffer7 interface.\n", This, VertexOp, DestIndex, Count, Src, SrcIndex, D3D, Flags);
return IDirect3DVertexBuffer7_ProcessVertices(ICOM_INTERFACE(This, IDirect3DVertexBuffer7),
VertexOp,
DestIndex,
Count,
ICOM_INTERFACE(Src, IDirect3DVertexBuffer7),
SrcIndex,
ICOM_INTERFACE(D3D, IDirect3DDevice7),
Flags);
return IDirect3DVertexBuffer7_ProcessVertices((IDirect3DVertexBuffer7 *)This, VertexOp, DestIndex,
Count, (IDirect3DVertexBuffer7 *)Src, SrcIndex, (IDirect3DDevice7 *)D3D, Flags);
}
/*****************************************************************************
......@@ -484,8 +473,7 @@ Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc(IDirect3DVertexBuffer *ifa
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, Desc);
return IDirect3DVertexBuffer7_GetVertexBufferDesc(ICOM_INTERFACE(This, IDirect3DVertexBuffer7),
Desc);
return IDirect3DVertexBuffer7_GetVertexBufferDesc((IDirect3DVertexBuffer7 *)This, Desc);
}
......@@ -536,9 +524,7 @@ Thunk_IDirect3DVertexBufferImpl_1_Optimize(IDirect3DVertexBuffer *iface,
IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice3, D3DDevice);
TRACE_(ddraw_thunk)("(%p)->(%p,%08x) thunking to IDirect3DVertexBuffer7 interface.\n", This, D3D, Flags);
return IDirect3DVertexBuffer7_Optimize(ICOM_INTERFACE(This, IDirect3DVertexBuffer7),
ICOM_INTERFACE(D3D, IDirect3DDevice7),
Flags);
return IDirect3DVertexBuffer7_Optimize((IDirect3DVertexBuffer7 *)This, (IDirect3DDevice7 *)D3D, Flags);
}
/*****************************************************************************
......
......@@ -86,7 +86,7 @@ void viewport_activate(IDirect3DViewportImpl* This, BOOL ignore_lights) {
}
/* And also set the viewport */
IDirect3DDevice7_SetViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice7), &vp);
IDirect3DDevice7_SetViewport((IDirect3DDevice7 *)This->active_device, &vp);
}
/*****************************************************************************
......@@ -148,8 +148,7 @@ IDirect3DViewportImpl_QueryInterface(IDirect3DViewport3 *iface,
REFIID riid,
void **obp)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), obp);
TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), obp);
*obp = NULL;
......@@ -157,12 +156,12 @@ IDirect3DViewportImpl_QueryInterface(IDirect3DViewport3 *iface,
IsEqualGUID(&IID_IDirect3DViewport, riid) ||
IsEqualGUID(&IID_IDirect3DViewport2, riid) ||
IsEqualGUID(&IID_IDirect3DViewport3, riid) ) {
IDirect3DViewport3_AddRef(ICOM_INTERFACE(This, IDirect3DViewport3));
*obp = ICOM_INTERFACE(This, IDirect3DViewport3);
IDirect3DViewport3_AddRef(iface);
*obp = iface;
TRACE(" Creating IDirect3DViewport1/2/3 interface %p\n", *obp);
return S_OK;
}
FIXME("(%p): interface for IID %s NOT found!\n", This, debugstr_guid(riid));
FIXME("(%p): interface for IID %s NOT found!\n", iface, debugstr_guid(riid));
return E_NOINTERFACE;
}
......@@ -312,7 +311,8 @@ IDirect3DViewportImpl_SetViewport(IDirect3DViewport3 *iface,
This->viewports.vp1.dvMaxZ = 1.0;
if (This->active_device) {
IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), &current_viewport);
IDirect3DDevice3 *d3d_device3 = (IDirect3DDevice3 *)&This->active_device->IDirect3DDevice3_vtbl;
IDirect3DDevice3_GetCurrentViewport(d3d_device3, &current_viewport);
if (current_viewport) {
if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
This->activate(This, FALSE);
......@@ -668,12 +668,14 @@ IDirect3DViewportImpl_Clear(IDirect3DViewport3 *iface,
DWORD color = 0x00000000;
HRESULT hr;
LPDIRECT3DVIEWPORT3 current_viewport;
IDirect3DDevice3 *d3d_device3;
TRACE("(%p/%p)->(%08x,%p,%08x)\n", This, iface, dwCount, lpRects, dwFlags);
if (This->active_device == NULL) {
ERR(" Trying to clear a viewport not attached to a device !\n");
return D3DERR_VIEWPORTHASNODEVICE;
}
d3d_device3 = (IDirect3DDevice3 *)&This->active_device->IDirect3DDevice3_vtbl;
EnterCriticalSection(&ddraw_cs);
if (dwFlags & D3DCLEAR_TARGET) {
......@@ -692,15 +694,10 @@ IDirect3DViewportImpl_Clear(IDirect3DViewport3 *iface,
afterwards. */
This->activate(This, TRUE);
hr = IDirect3DDevice7_Clear(ICOM_INTERFACE(This->active_device, IDirect3DDevice7),
dwCount,
lpRects,
dwFlags & (D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET),
color,
1.0,
0x00000000);
hr = IDirect3DDevice7_Clear((IDirect3DDevice7 *)This->active_device, dwCount, lpRects,
dwFlags & (D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET), color, 1.0, 0x00000000);
IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), &current_viewport);
IDirect3DDevice3_GetCurrentViewport(d3d_device3, &current_viewport);
if(current_viewport) {
IDirect3DViewportImpl *vp = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport);
vp->activate(vp, TRUE);
......@@ -915,7 +912,8 @@ IDirect3DViewportImpl_SetViewport2(IDirect3DViewport3 *iface,
memcpy(&(This->viewports.vp2), lpData, lpData->dwSize);
if (This->active_device) {
IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), &current_viewport);
IDirect3DDevice3 *d3d_device3 = (IDirect3DDevice3 *)&This->active_device->IDirect3DDevice3_vtbl;
IDirect3DDevice3_GetCurrentViewport(d3d_device3, &current_viewport);
if (current_viewport) {
if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
This->activate(This, FALSE);
......@@ -1003,6 +1001,7 @@ IDirect3DViewportImpl_Clear2(IDirect3DViewport3 *iface,
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
HRESULT hr;
LPDIRECT3DVIEWPORT3 current_viewport;
IDirect3DDevice3 *d3d_device3;
TRACE("(%p)->(%08x,%p,%08x,%08x,%f,%08x)\n", This, dwCount, lpRects, dwFlags, dwColor, dvZ, dwStencil);
EnterCriticalSection(&ddraw_cs);
......@@ -1011,18 +1010,14 @@ IDirect3DViewportImpl_Clear2(IDirect3DViewport3 *iface,
LeaveCriticalSection(&ddraw_cs);
return D3DERR_VIEWPORTHASNODEVICE;
}
d3d_device3 = (IDirect3DDevice3 *)&This->active_device->IDirect3DDevice3_vtbl;
/* Need to temporarily activate viewport to clear it. Previously active one will be restored
afterwards. */
This->activate(This, TRUE);
hr = IDirect3DDevice7_Clear(ICOM_INTERFACE(This->active_device, IDirect3DDevice7),
dwCount,
lpRects,
dwFlags,
dwColor,
dvZ,
dwStencil);
IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), &current_viewport);
hr = IDirect3DDevice7_Clear((IDirect3DDevice7 *)This->active_device,
dwCount, lpRects, dwFlags, dwColor, dvZ, dwStencil);
IDirect3DDevice3_GetCurrentViewport(d3d_device3, &current_viewport);
if(current_viewport) {
IDirect3DViewportImpl *vp = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport);
vp->activate(vp, TRUE);
......
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