ddraw: Get rid of ICOM_INTERFACE.

This commit is contained in:
Henri Verbeet 2009-01-21 09:56:13 +01:00 committed by Alexandre Julliard
parent ad171b143f
commit 9a0c885e63
16 changed files with 333 additions and 558 deletions

View File

@ -62,14 +62,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
static HRESULT WINAPI IDirectDrawClipperImpl_QueryInterface( static HRESULT WINAPI IDirectDrawClipperImpl_QueryInterface(
LPDIRECTDRAWCLIPPER iface, REFIID riid, LPVOID* ppvObj LPDIRECTDRAWCLIPPER iface, REFIID riid, LPVOID* ppvObj
) { ) {
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
if (IsEqualGUID(&IID_IUnknown, riid) if (IsEqualGUID(&IID_IUnknown, riid)
|| IsEqualGUID(&IID_IDirectDrawClipper, riid)) || IsEqualGUID(&IID_IDirectDrawClipper, riid))
{ {
*ppvObj = ICOM_INTERFACE(This, IDirectDrawClipper); IUnknown_AddRef(iface);
InterlockedIncrement(&This->ref); *ppvObj = iface;
return S_OK; return S_OK;
} }
else else
{ {

View File

@ -38,11 +38,7 @@
#define ICOM_THIS_FROM(impltype, ifacename, ifaceptr) \ #define ICOM_THIS_FROM(impltype, ifacename, ifaceptr) \
impltype* This = ICOM_OBJECT(impltype, ifacename, ifaceptr) impltype* This = ICOM_OBJECT(impltype, ifacename, ifaceptr)
/* Given an object and interface name, returns a pointer to that interface. */ #define COM_INTERFACE_CAST(impltype, ifnamefrom, ifnameto, ifaceptr) \
#define ICOM_INTERFACE(implobj, iface) \ ((ifaceptr) ? (ifnameto *)&(((impltype *)((char *)(ifaceptr) \
((iface *)(implobj == NULL ? NULL :&((implobj)->ICOM_VFIELD_MULTI_NAME(iface)))) - ICOM_VFIELD_OFFSET(impltype, ifnamefrom)))->ICOM_VFIELD_MULTI_NAME(ifnameto)) : NULL)
#define COM_INTERFACE_CAST(impltype, ifnamefrom, ifnameto, ifaceptr) \
ICOM_INTERFACE(ICOM_OBJECT(impltype, ifnamefrom, ifaceptr), ifnameto)
#endif /* _DDCOMIMPL_H_ */ #endif /* _DDCOMIMPL_H_ */

View File

@ -111,12 +111,12 @@ IDirectDrawImpl_QueryInterface(IDirectDraw7 *iface,
if ( IsEqualGUID( &IID_IUnknown, refiid ) || if ( IsEqualGUID( &IID_IUnknown, refiid ) ||
IsEqualGUID( &IID_IDirectDraw7, refiid ) ) IsEqualGUID( &IID_IDirectDraw7, refiid ) )
{ {
*obj = ICOM_INTERFACE(This, IDirectDraw7); *obj = &This->IDirectDraw7_vtbl;
TRACE("(%p) Returning IDirectDraw7 interface at %p\n", This, *obj); TRACE("(%p) Returning IDirectDraw7 interface at %p\n", This, *obj);
} }
else if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) ) 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); TRACE("(%p) Returning IDirectDraw4 interface at %p\n", This, *obj);
} }
else if ( IsEqualGUID( &IID_IDirectDraw3, refiid ) ) else if ( IsEqualGUID( &IID_IDirectDraw3, refiid ) )
@ -129,12 +129,12 @@ IDirectDrawImpl_QueryInterface(IDirectDraw7 *iface,
} }
else if ( IsEqualGUID( &IID_IDirectDraw2, refiid ) ) 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); TRACE("(%p) Returning IDirectDraw2 interface at %p\n", This, *obj);
} }
else if ( IsEqualGUID( &IID_IDirectDraw, refiid ) ) 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); TRACE("(%p) Returning IDirectDraw interface at %p\n", This, *obj);
} }
@ -173,25 +173,25 @@ IDirectDrawImpl_QueryInterface(IDirectDraw7 *iface,
if ( IsEqualGUID( &IID_IDirect3D , refiid ) ) if ( IsEqualGUID( &IID_IDirect3D , refiid ) )
{ {
This->d3dversion = 1; This->d3dversion = 1;
*obj = ICOM_INTERFACE(This, IDirect3D); *obj = &This->IDirect3D_vtbl;
TRACE(" returning Direct3D interface at %p.\n", *obj); TRACE(" returning Direct3D interface at %p.\n", *obj);
} }
else if ( IsEqualGUID( &IID_IDirect3D2 , refiid ) ) else if ( IsEqualGUID( &IID_IDirect3D2 , refiid ) )
{ {
This->d3dversion = 2; This->d3dversion = 2;
*obj = ICOM_INTERFACE(This, IDirect3D2); *obj = &This->IDirect3D2_vtbl;
TRACE(" returning Direct3D2 interface at %p.\n", *obj); TRACE(" returning Direct3D2 interface at %p.\n", *obj);
} }
else if ( IsEqualGUID( &IID_IDirect3D3 , refiid ) ) else if ( IsEqualGUID( &IID_IDirect3D3 , refiid ) )
{ {
This->d3dversion = 3; This->d3dversion = 3;
*obj = ICOM_INTERFACE(This, IDirect3D3); *obj = &This->IDirect3D3_vtbl;
TRACE(" returning Direct3D3 interface at %p.\n", *obj); TRACE(" returning Direct3D3 interface at %p.\n", *obj);
} }
else if(IsEqualGUID( &IID_IDirect3D7 , refiid )) else if(IsEqualGUID( &IID_IDirect3D7 , refiid ))
{ {
This->d3dversion = 7; This->d3dversion = 7;
*obj = ICOM_INTERFACE(This, IDirect3D7); *obj = &This->IDirect3D7_vtbl;
TRACE(" returning Direct3D7 interface at %p.\n", *obj); TRACE(" returning Direct3D7 interface at %p.\n", *obj);
} }
} }
@ -258,9 +258,7 @@ void
IDirectDrawImpl_Destroy(IDirectDrawImpl *This) IDirectDrawImpl_Destroy(IDirectDrawImpl *This)
{ {
/* Clear the cooplevel to restore window and display mode */ /* Clear the cooplevel to restore window and display mode */
IDirectDraw7_SetCooperativeLevel(ICOM_INTERFACE(This, IDirectDraw7), IDirectDraw7_SetCooperativeLevel((IDirectDraw7 *)This, NULL, DDSCL_NORMAL);
NULL,
DDSCL_NORMAL);
/* Destroy the device window if we created one */ /* Destroy the device window if we created one */
if(This->devicewindow != 0) if(This->devicewindow != 0)
@ -667,12 +665,8 @@ IDirectDrawImpl_RestoreDisplayMode(IDirectDraw7 *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw7, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw7, iface);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
return IDirectDrawImpl_SetDisplayModeNoOverride(ICOM_INTERFACE(This, IDirectDraw7), return IDirectDrawImpl_SetDisplayModeNoOverride(iface,
This->orig_width, This->orig_width, This->orig_height, This->orig_bpp, 0, 0);
This->orig_height,
This->orig_bpp,
0,
0);
} }
/***************************************************************************** /*****************************************************************************
@ -1817,11 +1811,7 @@ IDirectDrawImpl_RecreateAllSurfaces(IDirectDrawImpl *This)
memset(&desc, 0, sizeof(desc)); memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc); desc.dwSize = sizeof(desc);
return IDirectDraw7_EnumSurfaces(ICOM_INTERFACE(This, IDirectDraw7), return IDirectDraw7_EnumSurfaces((IDirectDraw7 *)This, 0, &desc, This, IDirectDrawImpl_RecreateSurfacesCallback);
0,
&desc,
This,
IDirectDrawImpl_RecreateSurfacesCallback);
} }
ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) { ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) {
@ -2037,13 +2027,13 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
} }
parImpl->ref = 1; parImpl->ref = 1;
parImpl->IParent_vtbl = &IParent_Vtbl; parImpl->IParent_vtbl = &IParent_Vtbl;
Parent = (IUnknown *) ICOM_INTERFACE(parImpl, IParent); Parent = (IUnknown *)parImpl;
TRACE("Using IParent interface %p as parent\n", parImpl); TRACE("Using IParent interface %p as parent\n", parImpl);
} }
else else
{ {
/* Use the surface as parent */ /* Use the surface as parent */
Parent = (IUnknown *) ICOM_INTERFACE(*ppSurf, IDirectDrawSurface7); Parent = (IUnknown *)*ppSurf;
TRACE("Using Surface interface %p as parent\n", *ppSurf); TRACE("Using Surface interface %p as parent\n", *ppSurf);
} }
@ -2173,7 +2163,7 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
if(hr != WINED3D_OK) if(hr != WINED3D_OK)
{ {
/* No need for a trace here, wined3d does that for us */ /* No need for a trace here, wined3d does that for us */
IDirectDrawSurface7_Release(ICOM_INTERFACE((*ppSurf), IDirectDrawSurface7)); IDirectDrawSurface7_Release((IDirectDrawSurface7 *)*ppSurf);
return hr; return hr;
} }
} }
@ -2597,7 +2587,7 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
} }
object->is_complex_root = TRUE; object->is_complex_root = TRUE;
*Surf = ICOM_INTERFACE(object, IDirectDrawSurface7); *Surf = (IDirectDrawSurface7 *)object;
/* Create Additional surfaces if necessary /* Create Additional surfaces if necessary
* This applies to Primary surfaces which have a back buffer count * This applies to Primary surfaces which have a back buffer count
@ -2637,7 +2627,7 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
if(hr != DD_OK) if(hr != DD_OK)
{ {
/* This destroys and possibly created surfaces too */ /* This destroys and possibly created surfaces too */
IDirectDrawSurface_Release( ICOM_INTERFACE(object, IDirectDrawSurface7) ); IDirectDrawSurface_Release((IDirectDrawSurface7 *)object);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return hr; return hr;
} }
@ -2739,13 +2729,13 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
{ {
hr = IWineD3DDevice_CreateCubeTexture(This->wineD3DDevice, DDSD->dwWidth /* Edgelength */, hr = IWineD3DDevice_CreateCubeTexture(This->wineD3DDevice, DDSD->dwWidth /* Edgelength */,
levels, 0 /* usage */, Format, Pool, (IWineD3DCubeTexture **)&object->wineD3DTexture, levels, 0 /* usage */, Format, Pool, (IWineD3DCubeTexture **)&object->wineD3DTexture,
0 /* SharedHandle */, (IUnknown *)ICOM_INTERFACE(object, IDirectDrawSurface7)); 0 /* SharedHandle */, (IUnknown *)object);
} }
else else
{ {
hr = IWineD3DDevice_CreateTexture(This->wineD3DDevice, DDSD->dwWidth, DDSD->dwHeight, levels, hr = IWineD3DDevice_CreateTexture(This->wineD3DDevice, DDSD->dwWidth, DDSD->dwHeight, levels,
0 /* usage */, Format, Pool, (IWineD3DTexture **) &object->wineD3DTexture, 0 /* usage */, Format, Pool, (IWineD3DTexture **) &object->wineD3DTexture,
0 /* SharedHandle */, (IUnknown *)ICOM_INTERFACE(object, IDirectDrawSurface7)); 0 /* SharedHandle */, (IUnknown *)object);
} }
This->tex_root = NULL; This->tex_root = NULL;
} }
@ -2925,8 +2915,8 @@ IDirectDrawImpl_EnumSurfaces(IDirectDraw7 *iface,
if (all || (nomatch != IDirectDrawImpl_DDSD_Match(DDSD, &surf->surface_desc))) if (all || (nomatch != IDirectDrawImpl_DDSD_Match(DDSD, &surf->surface_desc)))
{ {
desc = surf->surface_desc; desc = surf->surface_desc;
IDirectDrawSurface7_AddRef(ICOM_INTERFACE(surf, IDirectDrawSurface7)); IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)surf);
if(Callback( ICOM_INTERFACE(surf, IDirectDrawSurface7), &desc, Context) != DDENUMRET_OK) if (Callback((IDirectDrawSurface7 *)surf, &desc, Context) != DDENUMRET_OK)
{ {
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
@ -3229,7 +3219,8 @@ IDirectDrawImpl_CreatePalette(IDirectDraw7 *iface,
object->ref = 1; object->ref = 1;
object->ddraw_owner = This; 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) if(hr != DD_OK)
{ {
HeapFree(GetProcessHeap(), 0, object); HeapFree(GetProcessHeap(), 0, object);
@ -3239,7 +3230,7 @@ IDirectDrawImpl_CreatePalette(IDirectDraw7 *iface,
IDirectDraw7_AddRef(iface); IDirectDraw7_AddRef(iface);
object->ifaceToRelease = (IUnknown *) iface; object->ifaceToRelease = (IUnknown *) iface;
*Palette = ICOM_INTERFACE(object, IDirectDrawPalette); *Palette = (IDirectDrawPalette *)object;
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
} }
@ -3368,10 +3359,7 @@ IDirectDrawImpl_FindDecl(IDirectDrawImpl *This,
} }
TRACE("not found. Creating and inserting at position %d.\n", low); TRACE("not found. Creating and inserting at position %d.\n", low);
hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(This->wineD3DDevice, hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(This->wineD3DDevice, &pDecl, (IUnknown *)This, fvf);
&pDecl,
(IUnknown *) ICOM_INTERFACE(This, IDirectDraw7),
fvf);
if (hr != S_OK) return NULL; if (hr != S_OK) return NULL;
if(This->declArraySize == This->numConvertedDecls) { if(This->declArraySize == This->numConvertedDecls) {
@ -3467,8 +3455,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
if (!surf) if (!surf)
{ {
IDirectDrawSurface7 *attached; IDirectDrawSurface7 *attached;
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(This->tex_root, IDirectDrawSurface7), IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)This->tex_root, &searchcaps, &attached);
&searchcaps, &attached);
surf = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, attached); surf = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, attached);
IDirectDrawSurface7_Release(attached); IDirectDrawSurface7_Release(attached);
} }
@ -3478,7 +3465,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
while (i < level) while (i < level)
{ {
IDirectDrawSurface7 *attached; IDirectDrawSurface7 *attached;
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(surf, IDirectDrawSurface7), &searchcaps, &attached); IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)surf, &searchcaps, &attached);
if(!attached) ERR("Surface not found\n"); if(!attached) ERR("Surface not found\n");
surf = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, attached); surf = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, attached);
IDirectDrawSurface7_Release(attached); IDirectDrawSurface7_Release(attached);
@ -3507,8 +3494,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
if (d3d_surface->isRenderTarget) if (d3d_surface->isRenderTarget)
{ {
IDirectDrawSurface7_EnumAttachedSurfaces(ICOM_INTERFACE(d3d_surface, IDirectDrawSurface7), IDirectDrawSurface7_EnumAttachedSurfaces((IDirectDrawSurface7 *)d3d_surface, &target, findRenderTarget);
&target, findRenderTarget);
} }
else else
{ {
@ -3612,7 +3598,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
object->ref = 1; object->ref = 1;
hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters, hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters,
swapchain, (IUnknown *)ICOM_INTERFACE(object, IParent), This->ImplType); swapchain, (IUnknown *)object, This->ImplType);
if (FAILED(hr)) if (FAILED(hr))
{ {
FIXME("(%p) CreateSwapChain failed, returning %#x\n", iface, hr); FIXME("(%p) CreateSwapChain failed, returning %#x\n", iface, hr);

View File

@ -1126,7 +1126,7 @@ IDirectDrawImpl_Initialize(LPDIRECTDRAW iface, LPGUID pGUID)
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw, iface);
HRESULT ret_value; HRESULT ret_value;
ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID); ret_value = IDirectDraw7_Initialize((IDirectDraw7 *)This, pGUID);
return ret_value; return ret_value;
} }
@ -1137,7 +1137,7 @@ IDirectDraw2Impl_Initialize(LPDIRECTDRAW2 iface, LPGUID pGUID)
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw2, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw2, iface);
HRESULT ret_value; HRESULT ret_value;
ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID); ret_value = IDirectDraw7_Initialize((IDirectDraw7 *)This, pGUID);
return ret_value; return ret_value;
} }
@ -1148,7 +1148,7 @@ IDirectDraw3Impl_Initialize(LPDIRECTDRAW3 iface, LPGUID pGUID)
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw3, iface);
HRESULT ret_value; HRESULT ret_value;
ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID); ret_value = IDirectDraw7_Initialize((IDirectDraw7 *)This, pGUID);
return ret_value; return ret_value;
} }
@ -1159,7 +1159,7 @@ IDirectDraw4Impl_Initialize(LPDIRECTDRAW4 iface, LPGUID pGUID)
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw4, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw4, iface);
HRESULT ret_value; HRESULT ret_value;
ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID); ret_value = IDirectDraw7_Initialize((IDirectDraw7 *)This, pGUID);
return ret_value; return ret_value;
} }

File diff suppressed because it is too large Load Diff

View File

@ -54,9 +54,7 @@ Thunk_IDirect3DImpl_7_QueryInterface(IDirect3D7 *iface,
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
TRACE("(%p)->(%s,%p): Thunking to IDirectDraw7\n", This, debugstr_guid(refiid), obj); TRACE("(%p)->(%s,%p): Thunking to IDirectDraw7\n", This, debugstr_guid(refiid), obj);
return IDirectDraw7_QueryInterface(ICOM_INTERFACE(This, IDirectDraw7), return IDirectDraw7_QueryInterface((IDirectDraw7 *)This, refiid, obj);
refiid,
obj);
} }
static HRESULT WINAPI static HRESULT WINAPI
@ -67,9 +65,7 @@ Thunk_IDirect3DImpl_3_QueryInterface(IDirect3D3 *iface,
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
TRACE("(%p)->(%s,%p): Thunking to IDirectDraw7\n", This, debugstr_guid(refiid), obj); TRACE("(%p)->(%s,%p): Thunking to IDirectDraw7\n", This, debugstr_guid(refiid), obj);
return IDirectDraw7_QueryInterface(ICOM_INTERFACE(This, IDirectDraw7), return IDirectDraw7_QueryInterface((IDirectDraw7 *)This, refiid, obj);
refiid,
obj);
} }
static HRESULT WINAPI static HRESULT WINAPI
@ -80,9 +76,7 @@ Thunk_IDirect3DImpl_2_QueryInterface(IDirect3D2 *iface,
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
TRACE("(%p)->(%s,%p): Thunking to IDirectDraw7\n", This, debugstr_guid(refiid), obj); TRACE("(%p)->(%s,%p): Thunking to IDirectDraw7\n", This, debugstr_guid(refiid), obj);
return IDirectDraw7_QueryInterface(ICOM_INTERFACE(This, IDirectDraw7), return IDirectDraw7_QueryInterface((IDirectDraw7 *)This, refiid, obj);
refiid,
obj);
} }
static HRESULT WINAPI static HRESULT WINAPI
@ -93,9 +87,7 @@ Thunk_IDirect3DImpl_1_QueryInterface(IDirect3D *iface,
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p)->(%s,%p): Thunking to IDirectDraw7\n", This, debugstr_guid(refiid), obj); TRACE("(%p)->(%s,%p): Thunking to IDirectDraw7\n", This, debugstr_guid(refiid), obj);
return IDirectDraw7_QueryInterface(ICOM_INTERFACE(This, IDirectDraw7), return IDirectDraw7_QueryInterface((IDirectDraw7 *)This, refiid, obj);
refiid,
obj);
} }
/***************************************************************************** /*****************************************************************************
@ -123,7 +115,7 @@ Thunk_IDirect3DImpl_7_AddRef(IDirect3D7 *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
TRACE("(%p) : Thunking to IDirectDraw7.\n", This); TRACE("(%p) : Thunking to IDirectDraw7.\n", This);
return IDirectDraw7_AddRef(ICOM_INTERFACE(This, IDirectDraw7)); return IDirectDraw7_AddRef((IDirectDraw7 *)This);
} }
static ULONG WINAPI static ULONG WINAPI
@ -132,7 +124,7 @@ Thunk_IDirect3DImpl_3_AddRef(IDirect3D3 *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
TRACE("(%p) : Thunking to IDirectDraw.\n", This); TRACE("(%p) : Thunking to IDirectDraw.\n", This);
return IDirectDraw_AddRef(ICOM_INTERFACE(This, IDirectDraw)); return IDirectDraw_AddRef((IDirectDraw *)&This->IDirectDraw_vtbl);
} }
static ULONG WINAPI static ULONG WINAPI
@ -141,7 +133,7 @@ Thunk_IDirect3DImpl_2_AddRef(IDirect3D2 *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
TRACE("(%p) : Thunking to IDirectDraw.\n", This); TRACE("(%p) : Thunking to IDirectDraw.\n", This);
return IDirectDraw_AddRef(ICOM_INTERFACE(This, IDirectDraw)); return IDirectDraw_AddRef((IDirectDraw *)&This->IDirectDraw_vtbl);
} }
static ULONG WINAPI static ULONG WINAPI
@ -150,7 +142,7 @@ Thunk_IDirect3DImpl_1_AddRef(IDirect3D *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p) : Thunking to IDirectDraw.\n", This); 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); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
TRACE("(%p) : Thunking to IDirectDraw7.\n", This); TRACE("(%p) : Thunking to IDirectDraw7.\n", This);
return IDirectDraw7_Release(ICOM_INTERFACE(This, IDirectDraw7)); return IDirectDraw7_Release((IDirectDraw7 *)This);
} }
static ULONG WINAPI static ULONG WINAPI
@ -176,7 +168,7 @@ Thunk_IDirect3DImpl_3_Release(IDirect3D3 *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
TRACE("(%p) : Thunking to IDirectDraw.\n", This); TRACE("(%p) : Thunking to IDirectDraw.\n", This);
return IDirectDraw_Release(ICOM_INTERFACE(This, IDirectDraw)); return IDirectDraw_Release((IDirectDraw *)&This->IDirectDraw_vtbl);
} }
static ULONG WINAPI static ULONG WINAPI
@ -185,7 +177,7 @@ Thunk_IDirect3DImpl_2_Release(IDirect3D2 *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
TRACE("(%p) : Thunking to IDirectDraw.\n", This); TRACE("(%p) : Thunking to IDirectDraw.\n", This);
return IDirectDraw_Release(ICOM_INTERFACE(This, IDirectDraw)); return IDirectDraw_Release((IDirectDraw *)&This->IDirectDraw_vtbl);
} }
static ULONG WINAPI static ULONG WINAPI
@ -194,7 +186,7 @@ Thunk_IDirect3DImpl_1_Release(IDirect3D *iface)
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p) : Thunking to IDirectDraw.\n", This); 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); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Callback, Context); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Callback, Context);
return IDirect3D3_EnumDevices(ICOM_INTERFACE(This, IDirect3D3), return IDirect3D3_EnumDevices((IDirect3D3 *)&This->IDirect3D3_vtbl, Callback, Context);
Callback,
Context);
} }
static HRESULT WINAPI static HRESULT WINAPI
@ -399,9 +389,7 @@ Thunk_IDirect3DImpl_1_EnumDevices(IDirect3D *iface,
{ {
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Callback, Context); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Callback, Context);
return IDirect3D3_EnumDevices(ICOM_INTERFACE(This, IDirect3D3), return IDirect3D3_EnumDevices((IDirect3D3 *)&This->IDirect3D3_vtbl, Callback, Context);
Callback,
Context);
} }
/***************************************************************************** /*****************************************************************************
@ -454,7 +442,7 @@ IDirect3DImpl_3_CreateLight(IDirect3D3 *iface,
object->update = light_desactivate; object->update = light_desactivate;
object->active_viewport = NULL; object->active_viewport = NULL;
*Light = ICOM_INTERFACE(object, IDirect3DLight); *Light = (IDirect3DLight *)object;
TRACE("(%p) creating implementation at %p.\n", This, 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); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Direct3DLight, UnkOuter); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Direct3DLight, UnkOuter);
return IDirect3D3_CreateLight(ICOM_INTERFACE(This, IDirect3D3), return IDirect3D3_CreateLight((IDirect3D3 *)&This->IDirect3D3_vtbl, Direct3DLight, UnkOuter);
Direct3DLight,
UnkOuter);
} }
static HRESULT WINAPI static HRESULT WINAPI
@ -480,9 +466,7 @@ Thunk_IDirect3DImpl_1_CreateLight(IDirect3D *iface,
{ {
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Direct3DLight, UnkOuter); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Direct3DLight, UnkOuter);
return IDirect3D3_CreateLight(ICOM_INTERFACE(This, IDirect3D3), return IDirect3D3_CreateLight((IDirect3D3 *)&This->IDirect3D3_vtbl, Direct3DLight, UnkOuter);
Direct3DLight,
UnkOuter);
} }
/***************************************************************************** /*****************************************************************************
@ -529,7 +513,7 @@ IDirect3DImpl_3_CreateMaterial(IDirect3D3 *iface,
object->ddraw = This; object->ddraw = This;
object->activate = material_activate; object->activate = material_activate;
*Material = ICOM_INTERFACE(object, IDirect3DMaterial3); *Material = (IDirect3DMaterial3 *)object;
TRACE("(%p) creating implementation at %p.\n", This, object); TRACE("(%p) creating implementation at %p.\n", This, object);
@ -546,9 +530,7 @@ Thunk_IDirect3DImpl_2_CreateMaterial(IDirect3D2 *iface,
IDirect3DMaterial3 *ret_val; IDirect3DMaterial3 *ret_val;
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Direct3DMaterial, UnkOuter); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Direct3DMaterial, UnkOuter);
ret = IDirect3D3_CreateMaterial(ICOM_INTERFACE(This, IDirect3D3), ret = IDirect3D3_CreateMaterial((IDirect3D3 *)&This->IDirect3D3_vtbl, &ret_val, UnkOuter);
&ret_val,
UnkOuter);
*Direct3DMaterial = COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial3, IDirect3DMaterial2, ret_val); *Direct3DMaterial = COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial3, IDirect3DMaterial2, ret_val);
@ -567,9 +549,7 @@ Thunk_IDirect3DImpl_1_CreateMaterial(IDirect3D *iface,
LPDIRECT3DMATERIAL3 ret_val; LPDIRECT3DMATERIAL3 ret_val;
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Direct3DMaterial, UnkOuter); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, Direct3DMaterial, UnkOuter);
ret = IDirect3D3_CreateMaterial(ICOM_INTERFACE(This, IDirect3D3), ret = IDirect3D3_CreateMaterial((IDirect3D3 *)&This->IDirect3D3_vtbl, &ret_val, UnkOuter);
&ret_val,
UnkOuter);
*Direct3DMaterial = COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial3, IDirect3DMaterial, ret_val); *Direct3DMaterial = COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial3, IDirect3DMaterial, ret_val);
@ -623,7 +603,7 @@ IDirect3DImpl_3_CreateViewport(IDirect3D3 *iface,
object->num_lights = 0; object->num_lights = 0;
object->map_lights = 0; object->map_lights = 0;
*Viewport = ICOM_INTERFACE(object, IDirect3DViewport3); *Viewport = (IDirect3DViewport3 *)object;
TRACE("(%p) creating implementation at %p.\n",This, 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); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, D3DViewport2, UnkOuter); 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 */, (IDirect3DViewport3 **) D3DViewport2 /* No need to cast here */,
UnkOuter); UnkOuter);
} }
@ -651,7 +631,7 @@ Thunk_IDirect3DImpl_1_CreateViewport(IDirect3D *iface,
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, D3DViewport, UnkOuter); 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 */, (IDirect3DViewport3 **) D3DViewport /* No need to cast here */,
UnkOuter); UnkOuter);
} }
@ -723,9 +703,7 @@ Thunk_IDirect3DImpl_2_FindDevice(IDirect3D2 *iface,
{ {
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, D3DDFS, D3DFDR); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, D3DDFS, D3DFDR);
return IDirect3D3_FindDevice(ICOM_INTERFACE(This, IDirect3D3), return IDirect3D3_FindDevice((IDirect3D3 *)&This->IDirect3D3_vtbl, D3DDFS, D3DFDR);
D3DDFS,
D3DFDR);
} }
static HRESULT WINAPI static HRESULT WINAPI
@ -735,9 +713,7 @@ Thunk_IDirect3DImpl_1_FindDevice(IDirect3D *iface,
{ {
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, D3DDFS, D3DDevice); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", This, D3DDFS, D3DDevice);
return IDirect3D3_FindDevice(ICOM_INTERFACE(This, IDirect3D3), return IDirect3D3_FindDevice((IDirect3D3 *)&This->IDirect3D3_vtbl, D3DDFS, D3DDevice);
D3DDFS,
D3DDevice);
} }
/***************************************************************************** /*****************************************************************************
@ -852,7 +828,7 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
WINED3DPOOL_DEFAULT, WINED3DPOOL_DEFAULT,
&object->indexbuffer, &object->indexbuffer,
0 /* Handle */, 0 /* Handle */,
(IUnknown *) ICOM_INTERFACE(IndexBufferParent, IParent)); (IUnknown *)IndexBufferParent);
if(FAILED(hr)) if(FAILED(hr))
{ {
@ -869,7 +845,7 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
IWineD3DDevice_AddRef(This->wineD3DDevice); IWineD3DDevice_AddRef(This->wineD3DDevice);
/* Don't forget to return the interface ;) */ /* 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); 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. * add another ref which is released when the device is destroyed.
*/ */
IDirectDrawSurface7_AddRef(Surface); IDirectDrawSurface7_AddRef(Surface);
IDirectDrawSurface7_AddRef(ICOM_INTERFACE(This->d3d_target, IDirectDrawSurface7)); IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)This->d3d_target);
This->d3ddevice = object; This->d3ddevice = object;
@ -953,10 +929,8 @@ Thunk_IDirect3DImpl_3_CreateDevice(IDirect3D3 *iface,
if(UnkOuter != NULL) if(UnkOuter != NULL)
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
hr = IDirect3D7_CreateDevice(ICOM_INTERFACE(This, IDirect3D7), hr = IDirect3D7_CreateDevice((IDirect3D7 *)&This->IDirect3D7_vtbl, refiid,
refiid, (IDirectDrawSurface7 *)Surface /* Same VTables */, (IDirect3DDevice7 **)Device);
(IDirectDrawSurface7 *) Surface /* Same VTables */,
(IDirect3DDevice7 **) Device);
*Device = COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice7, IDirect3DDevice3, *Device); *Device = COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice7, IDirect3DDevice3, *Device);
return hr; return hr;
@ -972,10 +946,9 @@ Thunk_IDirect3DImpl_2_CreateDevice(IDirect3D2 *iface,
HRESULT hr; HRESULT hr;
TRACE("(%p)->(%s,%p,%p): Thunking to IDirect3D7\n", This, debugstr_guid(refiid), Surface, Device); TRACE("(%p)->(%s,%p,%p): Thunking to IDirect3D7\n", This, debugstr_guid(refiid), Surface, Device);
hr = IDirect3D7_CreateDevice(ICOM_INTERFACE(This, IDirect3D7), hr = IDirect3D7_CreateDevice((IDirect3D7 *)&This->IDirect3D7_vtbl, refiid,
refiid, COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface3, IDirectDrawSurface7, Surface),
COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface3, IDirectDrawSurface7, Surface), (IDirect3DDevice7 **)Device);
(IDirect3DDevice7 **) Device);
*Device = COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice7, IDirect3DDevice2, *Device); *Device = COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice7, IDirect3DDevice2, *Device);
return hr; return hr;
@ -1056,7 +1029,7 @@ IDirect3DImpl_7_CreateVertexBuffer(IDirect3D7 *iface,
Desc->dwCaps & D3DVBCAPS_SYSTEMMEMORY ? WINED3DPOOL_SYSTEMMEM : WINED3DPOOL_DEFAULT, Desc->dwCaps & D3DVBCAPS_SYSTEMMEMORY ? WINED3DPOOL_SYSTEMMEM : WINED3DPOOL_DEFAULT,
&object->wineD3DVertexBuffer, &object->wineD3DVertexBuffer,
0 /* SharedHandle */, 0 /* SharedHandle */,
(IUnknown *) ICOM_INTERFACE(object, IDirect3DVertexBuffer7)); (IUnknown *)object);
if(hr != D3D_OK) if(hr != D3D_OK)
{ {
ERR("(%p) IWineD3DDevice::CreateVertexBuffer failed with hr=%08x\n", This, hr); ERR("(%p) IWineD3DDevice::CreateVertexBuffer failed with hr=%08x\n", This, hr);
@ -1081,7 +1054,7 @@ IDirect3DImpl_7_CreateVertexBuffer(IDirect3D7 *iface,
IWineD3DVertexDeclaration_AddRef(object->wineD3DVertexDeclaration); IWineD3DVertexDeclaration_AddRef(object->wineD3DVertexDeclaration);
/* Return the interface */ /* 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); TRACE("(%p) Created new vertex buffer implementation at %p, returning interface at %p\n", This, object, *VertexBuffer);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
@ -1101,10 +1074,8 @@ Thunk_IDirect3DImpl_3_CreateVertexBuffer(IDirect3D3 *iface,
if(UnkOuter != NULL) return CLASS_E_NOAGGREGATION; if(UnkOuter != NULL) return CLASS_E_NOAGGREGATION;
hr = IDirect3D7_CreateVertexBuffer(ICOM_INTERFACE(This, IDirect3D7), hr = IDirect3D7_CreateVertexBuffer((IDirect3D7 *)&This->IDirect3D7_vtbl,
Desc, Desc, (IDirect3DVertexBuffer7 **)VertexBuffer, Flags);
(IDirect3DVertexBuffer7 **) VertexBuffer,
Flags);
*VertexBuffer = COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, IDirect3DVertexBuffer, *VertexBuffer); *VertexBuffer = COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, IDirect3DVertexBuffer, *VertexBuffer);
return hr; return hr;
@ -1237,10 +1208,7 @@ Thunk_IDirect3DImpl_3_EnumZBufferFormats(IDirect3D3 *iface,
{ {
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
TRACE("(%p)->(%s,%p,%p) thunking to IDirect3D7 interface.\n", This, debugstr_guid(riidDevice), Callback, Context); TRACE("(%p)->(%s,%p,%p) thunking to IDirect3D7 interface.\n", This, debugstr_guid(riidDevice), Callback, Context);
return IDirect3D7_EnumZBufferFormats(ICOM_INTERFACE(This, IDirect3D7), return IDirect3D7_EnumZBufferFormats((IDirect3D7 *)&This->IDirect3D7_vtbl, riidDevice, Callback, Context);
riidDevice,
Callback,
Context);
} }
/***************************************************************************** /*****************************************************************************
@ -1274,7 +1242,7 @@ Thunk_IDirect3DImpl_3_EvictManagedTextures(IDirect3D3 *iface)
{ {
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", This); TRACE("(%p)->() thunking to IDirect3D7 interface.\n", This);
return IDirect3D7_EvictManagedTextures(ICOM_INTERFACE(This, IDirect3D7)); return IDirect3D7_EvictManagedTextures((IDirect3D7 *)&This->IDirect3D7_vtbl);
} }
/***************************************************************************** /*****************************************************************************

View File

@ -175,8 +175,8 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
IWineD3DDevice_SetRenderState(lpDevice->wineD3DDevice, IWineD3DDevice_SetRenderState(lpDevice->wineD3DDevice,
WINED3DRS_COLORKEYENABLE, WINED3DRS_COLORKEYENABLE,
1); 1);
IDirect3DDevice7_DrawIndexedPrimitive(ICOM_INTERFACE(lpDevice,IDirect3DDevice7), IDirect3DDevice7_DrawIndexedPrimitive((IDirect3DDevice7 *)lpDevice,
D3DPT_TRIANGLELIST,D3DFVF_TLVERTEX,tl_vx,0,This->indices,count*3,0); D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, tl_vx, 0, This->indices, count * 3, 0);
} break; } break;
case D3DOP_MATRIXLOAD: case D3DOP_MATRIXLOAD:
@ -233,8 +233,8 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
lpDevice->view = ci->u2.dwArg[0]; lpDevice->view = ci->u2.dwArg[0];
if(ci->u1.drstRenderStateType == D3DTRANSFORMSTATE_PROJECTION) if(ci->u1.drstRenderStateType == D3DTRANSFORMSTATE_PROJECTION)
lpDevice->proj = ci->u2.dwArg[0]; lpDevice->proj = ci->u2.dwArg[0];
IDirect3DDevice7_SetTransform(ICOM_INTERFACE(lpDevice, IDirect3DDevice7), IDirect3DDevice7_SetTransform((IDirect3DDevice7 *)lpDevice,
ci->u1.drstRenderStateType, (LPD3DMATRIX) lpDevice->Handles[ci->u2.dwArg[0] - 1].ptr); ci->u1.drstRenderStateType, (LPD3DMATRIX)lpDevice->Handles[ci->u2.dwArg[0] - 1].ptr);
} }
instr += size; instr += size;
} }
@ -303,8 +303,7 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
break; break;
} }
IDirect3DDevice7_SetRenderState(ICOM_INTERFACE(lpDevice, IDirect3DDevice7), rs, IDirect3DDevice7_SetRenderState((IDirect3DDevice7 *)lpDevice, rs, ci->u2.dwArg[0]);
ci->u2.dwArg[0]);
} }
instr += size; instr += size;
@ -313,13 +312,13 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
case D3DOP_STATERENDER: { case D3DOP_STATERENDER: {
int i; int i;
IDirect3DDevice2 *d3d_device2 = (IDirect3DDevice2 *)&lpDevice->IDirect3DDevice2_vtbl;
TRACE("STATERENDER (%d)\n", count); TRACE("STATERENDER (%d)\n", count);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
LPD3DSTATE ci = (LPD3DSTATE) instr; LPD3DSTATE ci = (LPD3DSTATE) instr;
IDirect3DDevice2_SetRenderState(ICOM_INTERFACE(lpDevice, IDirect3DDevice2), IDirect3DDevice2_SetRenderState(d3d_device2, ci->u1.drstRenderStateType, ci->u2.dwArg[0]);
ci->u1.drstRenderStateType, ci->u2.dwArg[0]);
instr += size; instr += size;
} }
@ -592,24 +591,23 @@ IDirect3DExecuteBufferImpl_QueryInterface(IDirect3DExecuteBuffer *iface,
REFIID riid, REFIID riid,
void **obj) void **obj)
{ {
ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface); TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), obj);
TRACE("(%p/%p)->(%s,%p)\n", This, iface, debugstr_guid(riid), obj);
*obj = NULL; *obj = NULL;
if ( IsEqualGUID( &IID_IUnknown, riid ) ) { if ( IsEqualGUID( &IID_IUnknown, riid ) ) {
IDirect3DExecuteBuffer_AddRef(ICOM_INTERFACE(This, IDirect3DExecuteBuffer)); IDirect3DExecuteBuffer_AddRef(iface);
*obj = iface; *obj = iface;
TRACE(" Creating IUnknown interface at %p.\n", *obj); TRACE(" Creating IUnknown interface at %p.\n", *obj);
return S_OK; return S_OK;
} }
if ( IsEqualGUID( &IID_IDirect3DExecuteBuffer, riid ) ) { if ( IsEqualGUID( &IID_IDirect3DExecuteBuffer, riid ) ) {
IDirect3DExecuteBuffer_AddRef(ICOM_INTERFACE(This, IDirect3DExecuteBuffer)); IDirect3DExecuteBuffer_AddRef(iface);
*obj = ICOM_INTERFACE(This, IDirect3DExecuteBuffer); *obj = iface;
TRACE(" Creating IDirect3DExecuteBuffer interface %p\n", *obj); TRACE(" Creating IDirect3DExecuteBuffer interface %p\n", *obj);
return S_OK; 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; return E_NOINTERFACE;
} }

View File

@ -67,9 +67,7 @@ IDirectDrawGammaControlImpl_QueryInterface(IDirectDrawGammaControl *iface, REFII
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawGammaControl, iface); ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawGammaControl, iface);
TRACE_(ddraw_thunk)("(%p)->(%s,%p): Thunking to IDirectDrawSurface7\n", This, debugstr_guid(riid), obj); TRACE_(ddraw_thunk)("(%p)->(%s,%p): Thunking to IDirectDrawSurface7\n", This, debugstr_guid(riid), obj);
return IDirectDrawSurface7_QueryInterface(ICOM_INTERFACE(This, IDirectDrawSurface7), return IDirectDrawSurface7_QueryInterface((IDirectDrawSurface7 *)This, riid, obj);
riid,
obj);
} }
/********************************************************** /**********************************************************
@ -87,7 +85,7 @@ IDirectDrawGammaControlImpl_AddRef(IDirectDrawGammaControl *iface)
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawGammaControl, iface); ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawGammaControl, iface);
TRACE_(ddraw_thunk)("(%p)->() Thunking to IDirectDrawSurface7\n", This); 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); ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawGammaControl, iface);
TRACE_(ddraw_thunk)("(%p)->() Thunking to IDirectDrawSurface7\n", This); TRACE_(ddraw_thunk)("(%p)->() Thunking to IDirectDrawSurface7\n", This);
return IDirectDrawSurface7_Release(ICOM_INTERFACE(This, IDirectDrawSurface7)); return IDirectDrawSurface7_Release((IDirectDrawSurface7 *)This);
} }
/********************************************************** /**********************************************************

View File

@ -256,7 +256,7 @@ void light_update(IDirect3DLightImpl* This)
return; return;
device = This->active_viewport->active_device; 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); light_update(This);
/* If was not active, activate it */ /* If was not active, activate it */
if ((This->light.dwFlags & D3DLIGHT_ACTIVE) == 0) { 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; This->light.dwFlags |= D3DLIGHT_ACTIVE;
} }
} }
@ -302,7 +302,7 @@ void light_desactivate(IDirect3DLightImpl* This)
/* If was not active, activate it */ /* If was not active, activate it */
if ((This->light.dwFlags & D3DLIGHT_ACTIVE) != 0) { 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; This->light.dwFlags &= ~D3DLIGHT_ACTIVE;
} }
} }

View File

@ -233,8 +233,7 @@ DDRAW_Create(const GUID *guid,
* initialized * initialized
*/ */
hr = IWineD3D_CreateDevice(wineD3D, 0 /* D3D_ADAPTER_DEFAULT */, devicetype, NULL /* FocusWindow, don't know yet */, hr = IWineD3D_CreateDevice(wineD3D, 0 /* D3D_ADAPTER_DEFAULT */, devicetype, NULL /* FocusWindow, don't know yet */,
0 /* BehaviorFlags */, (IUnknown *)ICOM_INTERFACE(This, IDirectDraw7), 0 /* BehaviorFlags */, (IUnknown *)This, (IWineD3DDeviceParent *)&This->device_parent_vtbl, &wineD3DDevice);
(IWineD3DDeviceParent *)&This->device_parent_vtbl, &wineD3DDevice);
if(FAILED(hr)) if(FAILED(hr))
{ {
ERR("Failed to create a wineD3DDevice, result = %x\n", 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 /* Call QueryInterface to get the pointer to the requested interface. This also initializes
* The required refcount * 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; if(SUCCEEDED(hr)) return DD_OK;
err_out: err_out:
@ -705,7 +704,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance; factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
*ppv = ICOM_INTERFACE(factory, IClassFactory); *ppv = factory;
return S_OK; 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); 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 */ /* Add references to each interface to avoid freeing them unexpectedly */
IDirectDraw_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw)); IDirectDraw_AddRef((IDirectDraw *)&ddraw->IDirectDraw_vtbl);
IDirectDraw2_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw2)); IDirectDraw2_AddRef((IDirectDraw2 *)&ddraw->IDirectDraw2_vtbl);
IDirectDraw3_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw3)); IDirectDraw3_AddRef((IDirectDraw3 *)&ddraw->IDirectDraw3_vtbl);
IDirectDraw4_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw4)); IDirectDraw4_AddRef((IDirectDraw4 *)&ddraw->IDirectDraw4_vtbl);
IDirectDraw7_AddRef(ICOM_INTERFACE(ddraw, IDirectDraw7)); IDirectDraw7_AddRef((IDirectDraw7 *)ddraw);
/* Does a D3D device exist? Destroy it /* Does a D3D device exist? Destroy it
* TODO: Destroy all Vertex buffers, Lights, Materials * TODO: Destroy all Vertex buffers, Lights, Materials
@ -912,7 +911,7 @@ DllMain(HINSTANCE hInstDLL,
if(ddraw->d3ddevice) if(ddraw->d3ddevice)
{ {
WARN("DDraw %p has d3ddevice %p attached\n", ddraw, 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 /* Try to release the objects
@ -922,11 +921,8 @@ DllMain(HINSTANCE hInstDLL,
desc.dwSize = sizeof(desc); desc.dwSize = sizeof(desc);
for(i = 0; i <= 1; i++) for(i = 0; i <= 1; i++)
{ {
hr = IDirectDraw7_EnumSurfaces(ICOM_INTERFACE(ddraw, IDirectDraw7), hr = IDirectDraw7_EnumSurfaces((IDirectDraw7 *)ddraw,
DDENUMSURFACES_ALL, DDENUMSURFACES_ALL, &desc, ddraw, DestroyCallback);
&desc,
ddraw,
DestroyCallback);
if(hr != D3D_OK) if(hr != D3D_OK)
ERR("(%p) EnumSurfaces failed, prepare for trouble\n", ddraw); 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 /* Release all hanging references to destroy the objects. This
* restores the screen mode too * restores the screen mode too
*/ */
while(IDirectDraw_Release(ICOM_INTERFACE(ddraw, IDirectDraw))); while(IDirectDraw_Release((IDirectDraw *)&ddraw->IDirectDraw_vtbl));
while(IDirectDraw2_Release(ICOM_INTERFACE(ddraw, IDirectDraw2))); while(IDirectDraw2_Release((IDirectDraw2 *)&ddraw->IDirectDraw2_vtbl));
while(IDirectDraw3_Release(ICOM_INTERFACE(ddraw, IDirectDraw3))); while(IDirectDraw3_Release((IDirectDraw3 *)&ddraw->IDirectDraw3_vtbl));
while(IDirectDraw4_Release(ICOM_INTERFACE(ddraw, IDirectDraw4))); while(IDirectDraw4_Release((IDirectDraw4 *)&ddraw->IDirectDraw4_vtbl));
while(IDirectDraw7_Release(ICOM_INTERFACE(ddraw, IDirectDraw7))); while(IDirectDraw7_Release((IDirectDraw7 *)ddraw));
} }
} }
} }

View File

@ -80,26 +80,26 @@ IDirect3DMaterialImpl_QueryInterface(IDirect3DMaterial3 *iface,
*obp = NULL; *obp = NULL;
if ( IsEqualGUID( &IID_IUnknown, riid ) ) { if ( IsEqualGUID( &IID_IUnknown, riid ) ) {
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial)); IUnknown_AddRef(iface);
*obp = iface; *obp = iface;
TRACE(" Creating IUnknown interface at %p.\n", *obp); TRACE(" Creating IUnknown interface at %p.\n", *obp);
return S_OK; return S_OK;
} }
if ( IsEqualGUID( &IID_IDirect3DMaterial, riid ) ) { if ( IsEqualGUID( &IID_IDirect3DMaterial, riid ) ) {
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial)); IDirect3DMaterial_AddRef((IDirect3DMaterial *)&This->IDirect3DMaterial_vtbl);
*obp = ICOM_INTERFACE(This, IDirect3DMaterial); *obp = &This->IDirect3DMaterial_vtbl;
TRACE(" Creating IDirect3DMaterial interface %p\n", *obp); TRACE(" Creating IDirect3DMaterial interface %p\n", *obp);
return S_OK; return S_OK;
} }
if ( IsEqualGUID( &IID_IDirect3DMaterial2, riid ) ) { if ( IsEqualGUID( &IID_IDirect3DMaterial2, riid ) ) {
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial)); IDirect3DMaterial_AddRef((IDirect3DMaterial2 *)&This->IDirect3DMaterial2_vtbl);
*obp = ICOM_INTERFACE(This, IDirect3DMaterial2); *obp = &This->IDirect3DMaterial2_vtbl;
TRACE(" Creating IDirect3DMaterial2 interface %p\n", *obp); TRACE(" Creating IDirect3DMaterial2 interface %p\n", *obp);
return S_OK; return S_OK;
} }
if ( IsEqualGUID( &IID_IDirect3DMaterial3, riid ) ) { if ( IsEqualGUID( &IID_IDirect3DMaterial3, riid ) ) {
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial)); IDirect3DMaterial_AddRef((IDirect3DMaterial2 *)&This->IDirect3DMaterial3_vtbl);
*obp = ICOM_INTERFACE(This, IDirect3DMaterial3); *obp = &This->IDirect3DMaterial3_vtbl;
TRACE(" Creating IDirect3DMaterial3 interface %p\n", *obp); TRACE(" Creating IDirect3DMaterial3 interface %p\n", *obp);
return S_OK; return S_OK;
} }
@ -465,8 +465,7 @@ void material_activate(IDirect3DMaterialImpl* This)
d3d7mat.u3.emissive = This->mat.u3.emissive; d3d7mat.u3.emissive = This->mat.u3.emissive;
d3d7mat.u4.power = This->mat.u4.power; d3d7mat.u4.power = This->mat.u4.power;
IDirect3DDevice7_SetMaterial(ICOM_INTERFACE(This->active_device, IDirect3DDevice7), IDirect3DDevice7_SetMaterial((IDirect3DDevice7 *)This->active_device, &d3d7mat);
&d3d7mat);
} }
const IDirect3DMaterial3Vtbl IDirect3DMaterial3_Vtbl = const IDirect3DMaterial3Vtbl IDirect3DMaterial3_Vtbl =

View File

@ -68,15 +68,14 @@ IParentImpl_QueryInterface(IParent *iface,
REFIID riid, REFIID riid,
void **obj) void **obj)
{ {
ICOM_THIS_FROM(IParentImpl, IParent, iface); TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), obj);
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), obj);
*obj = NULL; *obj = NULL;
if ( IsEqualGUID( &IID_IUnknown, riid ) || if ( IsEqualGUID( &IID_IUnknown, riid ) ||
IsEqualGUID( &IID_IParent, riid ) ) IsEqualGUID( &IID_IParent, riid ) )
{ {
*obj = ICOM_INTERFACE(This, IParent); *obj = iface;
IParent_AddRef(ICOM_INTERFACE(This, IParent)); IParent_AddRef(iface);
return DD_OK; return DD_OK;
} }
return E_NOINTERFACE; return E_NOINTERFACE;

View File

@ -89,7 +89,7 @@ IDirectDrawSurfaceImpl_QueryInterface(IDirectDrawSurface7 *iface,
|| IsEqualGUID(riid, &IID_IDirectDrawSurface4) ) || IsEqualGUID(riid, &IID_IDirectDrawSurface4) )
{ {
IUnknown_AddRef(iface); IUnknown_AddRef(iface);
*obj = ICOM_INTERFACE(This, IDirectDrawSurface7); *obj = iface;
TRACE("(%p) returning IDirectDrawSurface7 interface at %p\n", This, *obj); TRACE("(%p) returning IDirectDrawSurface7 interface at %p\n", This, *obj);
return S_OK; return S_OK;
} }
@ -98,14 +98,14 @@ IDirectDrawSurfaceImpl_QueryInterface(IDirectDrawSurface7 *iface,
|| IsEqualGUID(riid, &IID_IDirectDrawSurface) ) || IsEqualGUID(riid, &IID_IDirectDrawSurface) )
{ {
IUnknown_AddRef(iface); IUnknown_AddRef(iface);
*obj = ICOM_INTERFACE(This, IDirectDrawSurface3); *obj = &This->IDirectDrawSurface3_vtbl;
TRACE("(%p) returning IDirectDrawSurface3 interface at %p\n", This, *obj); TRACE("(%p) returning IDirectDrawSurface3 interface at %p\n", This, *obj);
return S_OK; return S_OK;
} }
else if( IsEqualGUID(riid, &IID_IDirectDrawGammaControl) ) else if( IsEqualGUID(riid, &IID_IDirectDrawGammaControl) )
{ {
IUnknown_AddRef(iface); IUnknown_AddRef(iface);
*obj = ICOM_INTERFACE(This, IDirectDrawGammaControl); *obj = &This->IDirectDrawGammaControl_vtbl;
TRACE("(%p) returning IDirectDrawGammaControl interface at %p\n", This, *obj); TRACE("(%p) returning IDirectDrawGammaControl interface at %p\n", This, *obj);
return S_OK; return S_OK;
} }
@ -116,10 +116,7 @@ IDirectDrawSurfaceImpl_QueryInterface(IDirectDrawSurface7 *iface,
IDirect3DDevice7 *d3d; IDirect3DDevice7 *d3d;
/* Call into IDirect3D7 for creation */ /* Call into IDirect3D7 for creation */
IDirect3D7_CreateDevice(ICOM_INTERFACE(This->ddraw, IDirect3D7), IDirect3D7_CreateDevice((IDirect3D7 *)&This->ddraw->IDirect3D7_vtbl, riid, (IDirectDrawSurface7 *)This, &d3d);
riid,
ICOM_INTERFACE(This, IDirectDrawSurface7),
&d3d);
*obj = COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice7, IDirect3DDevice, d3d); *obj = COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice7, IDirect3DDevice, d3d);
TRACE("(%p) Returning IDirect3DDevice interface at %p\n", This, *obj); TRACE("(%p) Returning IDirect3DDevice interface at %p\n", This, *obj);
@ -131,12 +128,12 @@ IDirectDrawSurfaceImpl_QueryInterface(IDirectDrawSurface7 *iface,
{ {
if (IsEqualGUID( &IID_IDirect3DTexture, riid )) if (IsEqualGUID( &IID_IDirect3DTexture, riid ))
{ {
*obj = ICOM_INTERFACE(This, IDirect3DTexture); *obj = &This->IDirect3DTexture_vtbl;
TRACE(" returning Direct3DTexture interface at %p.\n", *obj); TRACE(" returning Direct3DTexture interface at %p.\n", *obj);
} }
else else
{ {
*obj = ICOM_INTERFACE(This, IDirect3DTexture2); *obj = &This->IDirect3DTexture2_vtbl;
TRACE(" returning Direct3DTexture2 interface at %p.\n", *obj); TRACE(" returning Direct3DTexture2 interface at %p.\n", *obj);
} }
IUnknown_AddRef( (IUnknown *) *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() * is called, because the refcount is held. It looks like the app released()
* it often enough to force this * it often enough to force this
*/ */
IDirectDrawSurface7 *root = ICOM_INTERFACE(This->first_attached, IDirectDrawSurface7); IDirectDrawSurface7 *root = (IDirectDrawSurface7 *)This->first_attached;
IDirectDrawSurface7 *detach = ICOM_INTERFACE(This, IDirectDrawSurface7); IDirectDrawSurface7 *detach = (IDirectDrawSurface7 *)This;
FIXME("(%p) Freeing a surface that is attached to surface %p\n", This, This->first_attached); 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) while(This->next_attached != NULL)
{ {
IDirectDrawSurface7 *root = ICOM_INTERFACE(This, IDirectDrawSurface7); IDirectDrawSurface7 *root = (IDirectDrawSurface7 *)This;
IDirectDrawSurface7 *detach = ICOM_INTERFACE(This->next_attached, IDirectDrawSurface7); IDirectDrawSurface7 *detach = (IDirectDrawSurface7 *)This->next_attached;
if(IDirectDrawSurface7_DeleteAttachedSurface(root, 0, detach) != DD_OK) 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 */ /* The refcount test shows that the palette is detached when the surface is destroyed */
IDirectDrawSurface7_SetPalette(ICOM_INTERFACE(This, IDirectDrawSurface7), IDirectDrawSurface7_SetPalette((IDirectDrawSurface7 *)This, NULL);
NULL);
/* Loop through all complex attached surfaces, /* Loop through all complex attached surfaces,
* and destroy them. * and destroy them.
@ -515,7 +511,7 @@ IDirectDrawSurfaceImpl_GetAttachedSurface(IDirectDrawSurface7 *iface,
TRACE("(%p): Returning surface %p\n", This, surf); TRACE("(%p): Returning surface %p\n", This, surf);
TRACE("(%p): mipmapcount=%d\n", This, surf->mipmap_level); TRACE("(%p): mipmapcount=%d\n", This, surf->mipmap_level);
*Surface = ICOM_INTERFACE(surf, IDirectDrawSurface7); *Surface = (IDirectDrawSurface7 *)surf;
IDirectDrawSurface7_AddRef(*Surface); IDirectDrawSurface7_AddRef(*Surface);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
@ -540,7 +536,7 @@ IDirectDrawSurfaceImpl_GetAttachedSurface(IDirectDrawSurface7 *iface,
((surf->surface_desc.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2)) { ((surf->surface_desc.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2)) {
TRACE("(%p): Returning surface %p\n", This, surf); TRACE("(%p): Returning surface %p\n", This, surf);
*Surface = ICOM_INTERFACE(surf, IDirectDrawSurface7); *Surface = (IDirectDrawSurface7 *)surf;
IDirectDrawSurface7_AddRef(*Surface); IDirectDrawSurface7_AddRef(*Surface);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
@ -927,7 +923,7 @@ IDirectDrawSurfaceImpl_AddAttachedSurface(IDirectDrawSurfaceImpl *This,
/* MSDN: /* MSDN:
* "This method increments the reference count of the surface being attached." * "This method increments the reference count of the surface being attached."
*/ */
IDirectDrawSurface7_AddRef(ICOM_INTERFACE(Surf, IDirectDrawSurface7)); IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)Surf);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
} }
@ -1397,10 +1393,10 @@ IDirectDrawSurfaceImpl_EnumAttachedSurfaces(IDirectDrawSurface7 *iface,
surf = This->complex_array[i]; surf = This->complex_array[i];
if(!surf) break; if(!surf) break;
IDirectDrawSurface7_AddRef(ICOM_INTERFACE(surf, IDirectDrawSurface7)); IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)surf);
desc = surf->surface_desc; desc = surf->surface_desc;
/* check: != DDENUMRET_OK or == DDENUMRET_CANCEL? */ /* 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); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
@ -1409,10 +1405,10 @@ IDirectDrawSurfaceImpl_EnumAttachedSurfaces(IDirectDrawSurface7 *iface,
for (surf = This->next_attached; surf != NULL; surf = surf->next_attached) 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; desc = surf->surface_desc;
/* check: != DDENUMRET_OK or == DDENUMRET_CANCEL? */ /* 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); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
@ -1938,26 +1934,23 @@ IDirectDrawSurfaceImpl_GetDDInterface(IDirectDrawSurface7 *iface,
switch(This->version) switch(This->version)
{ {
case 7: case 7:
*((IDirectDraw7 **) DD) = ICOM_INTERFACE(This->ddraw, IDirectDraw7); *DD = This->ddraw;
IDirectDraw7_AddRef(*(IDirectDraw7 **) DD);
break; break;
case 4: case 4:
*((IDirectDraw4 **) DD) = ICOM_INTERFACE(This->ddraw, IDirectDraw4); *DD = &This->ddraw->IDirectDraw4_vtbl;
IDirectDraw4_AddRef(*(IDirectDraw4 **) DD);
break; break;
case 2: case 2:
*((IDirectDraw2 **) DD) = ICOM_INTERFACE(This->ddraw, IDirectDraw2); *DD = &This->ddraw->IDirectDraw2_vtbl;
IDirectDraw_AddRef( *(IDirectDraw2 **) DD);
break; break;
case 1: case 1:
*((IDirectDraw **) DD) = ICOM_INTERFACE(This->ddraw, IDirectDraw); *DD = &This->ddraw->IDirectDraw_vtbl;
IDirectDraw_AddRef( *(IDirectDraw **) DD);
break; break;
} }
IUnknown_AddRef((IUnknown *)*DD);
return DD_OK; return DD_OK;
} }
@ -2189,7 +2182,7 @@ IDirectDrawSurfaceImpl_GetClipper(IDirectDrawSurface7 *iface,
return DDERR_NOCLIPPERATTACHED; return DDERR_NOCLIPPERATTACHED;
} }
*Clipper = ICOM_INTERFACE(This->clipper, IDirectDrawClipper); *Clipper = (IDirectDrawClipper *)This->clipper;
IDirectDrawClipper_AddRef(*Clipper); IDirectDrawClipper_AddRef(*Clipper);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DD_OK; return DD_OK;
@ -2229,7 +2222,7 @@ IDirectDrawSurfaceImpl_SetClipper(IDirectDrawSurface7 *iface,
if (Clipper != NULL) if (Clipper != NULL)
IDirectDrawClipper_AddRef(Clipper); IDirectDrawClipper_AddRef(Clipper);
if(oldClipper) if(oldClipper)
IDirectDrawClipper_Release(ICOM_INTERFACE(oldClipper, IDirectDrawClipper)); IDirectDrawClipper_Release((IDirectDrawClipper *)oldClipper);
hr = IWineD3DSurface_SetClipper(This->WineD3DSurface, This->clipper ? This->clipper->wineD3DClipper : NULL); hr = IWineD3DSurface_SetClipper(This->WineD3DSurface, This->clipper ? This->clipper->wineD3DClipper : NULL);
@ -2591,8 +2584,7 @@ IDirectDrawSurfaceImpl_SetPalette(IDirectDrawSurface7 *iface,
{ {
IDirectDrawSurface7 *attach; IDirectDrawSurface7 *attach;
HRESULT hr; HRESULT hr;
hr = IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(surf, IDirectDrawSurface7), hr = IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)surf, &caps2, &attach);
&caps2, &attach);
if(hr != DD_OK) if(hr != DD_OK)
{ {
break; break;

View File

@ -55,9 +55,7 @@ Thunk_IDirect3DTextureImpl_2_QueryInterface(IDirect3DTexture2 *iface,
{ {
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface); ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface);
TRACE("(%p)->(%s,%p) thunking to IDirectDrawSurface7 interface.\n", This, debugstr_guid(riid), obj); TRACE("(%p)->(%s,%p) thunking to IDirectDrawSurface7 interface.\n", This, debugstr_guid(riid), obj);
return IDirectDrawSurface7_QueryInterface(ICOM_INTERFACE(This, IDirectDrawSurface7), return IDirectDrawSurface7_QueryInterface((IDirectDrawSurface7 *)This, riid, obj);
riid,
obj);
} }
static HRESULT WINAPI static HRESULT WINAPI
@ -68,9 +66,7 @@ Thunk_IDirect3DTextureImpl_1_QueryInterface(IDirect3DTexture *iface,
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture, iface); ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture, iface);
TRACE("(%p)->(%s,%p) thunking to IDirectDrawSurface7 interface.\n", This, debugstr_guid(riid), obj); TRACE("(%p)->(%s,%p) thunking to IDirectDrawSurface7 interface.\n", This, debugstr_guid(riid), obj);
return IDirectDrawSurface7_QueryInterface(ICOM_INTERFACE(This, IDirectDrawSurface7), return IDirectDrawSurface7_QueryInterface((IDirectDrawSurface7 *)This, riid, obj);
riid,
obj);
} }
static ULONG WINAPI static ULONG WINAPI
@ -79,7 +75,7 @@ Thunk_IDirect3DTextureImpl_2_AddRef(IDirect3DTexture2 *iface)
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface); ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface);
TRACE("(%p)->() thunking to IDirectDrawSurface7 interface.\n", This); TRACE("(%p)->() thunking to IDirectDrawSurface7 interface.\n", This);
return IDirectDrawSurface7_AddRef(ICOM_INTERFACE(This, IDirectDrawSurface7)); return IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)This);
} }
static ULONG WINAPI static ULONG WINAPI
@ -97,7 +93,7 @@ Thunk_IDirect3DTextureImpl_2_Release(IDirect3DTexture2 *iface)
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface); ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface);
TRACE("(%p)->() thunking to IDirectDrawSurface7 interface.\n", This); 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); ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture, iface);
IDirect3DDeviceImpl *d3d = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice, lpDirect3DDevice); 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); TRACE_(ddraw_thunk)("(%p)->(%p,%p) thunking to IDirect3DTexture2 interface.\n", This, d3d, lpHandle);
return IDirect3DTexture2_GetHandle(ICOM_INTERFACE(This, IDirect3DTexture2), return IDirect3DTexture2_GetHandle(d3d_texture2, d3d_device2, lpHandle);
ICOM_INTERFACE(d3d, IDirect3DDevice2),
lpHandle);
} }
@ -267,8 +264,7 @@ get_sub_mimaplevel(IDirectDrawSurfaceImpl *tex_ptr)
IDirectDrawSurfaceImpl *surf_ptr; IDirectDrawSurfaceImpl *surf_ptr;
HRESULT hr; HRESULT hr;
hr = IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(tex_ptr, IDirectDrawSurface7), hr = IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)tex_ptr, &mipmap_caps, &next_level);
&mipmap_caps, &next_level);
if (FAILED(hr)) return NULL; if (FAILED(hr)) return NULL;
surf_ptr = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, next_level); surf_ptr = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, next_level);

View File

@ -77,22 +77,22 @@ IDirect3DVertexBufferImpl_QueryInterface(IDirect3DVertexBuffer7 *iface,
if ( IsEqualGUID( &IID_IUnknown, riid ) ) if ( IsEqualGUID( &IID_IUnknown, riid ) )
{ {
IDirect3DVertexBuffer7_AddRef(ICOM_INTERFACE(This,IDirect3DVertexBuffer7)); IUnknown_AddRef(iface);
*obj = iface; *obj = iface;
TRACE(" Creating IUnknown interface at %p.\n", *obj); TRACE(" Creating IUnknown interface at %p.\n", *obj);
return S_OK; return S_OK;
} }
if ( IsEqualGUID( &IID_IDirect3DVertexBuffer, riid ) ) if ( IsEqualGUID( &IID_IDirect3DVertexBuffer, riid ) )
{ {
IDirect3DVertexBuffer7_AddRef(ICOM_INTERFACE(This,IDirect3DVertexBuffer7)); IUnknown_AddRef(iface);
*obj = ICOM_INTERFACE(This, IDirect3DVertexBuffer); *obj = &This->IDirect3DVertexBuffer_vtbl;
TRACE(" Creating IDirect3DVertexBuffer interface %p\n", *obj); TRACE(" Creating IDirect3DVertexBuffer interface %p\n", *obj);
return S_OK; return S_OK;
} }
if ( IsEqualGUID( &IID_IDirect3DVertexBuffer7, riid ) ) if ( IsEqualGUID( &IID_IDirect3DVertexBuffer7, riid ) )
{ {
IDirect3DVertexBuffer7_AddRef(ICOM_INTERFACE(This,IDirect3DVertexBuffer7)); IUnknown_AddRef(iface);
*obj = ICOM_INTERFACE(This, IDirect3DVertexBuffer7); *obj = iface;
TRACE(" Creating IDirect3DVertexBuffer7 interface %p\n", *obj); TRACE(" Creating IDirect3DVertexBuffer7 interface %p\n", *obj);
return S_OK; return S_OK;
} }
@ -108,9 +108,7 @@ Thunk_IDirect3DVertexBufferImpl_1_QueryInterface(IDirect3DVertexBuffer *iface,
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface); ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
TRACE_(ddraw_thunk)("(%p)->(%s,%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, debugstr_guid(riid), obj); TRACE_(ddraw_thunk)("(%p)->(%s,%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, debugstr_guid(riid), obj);
return IDirect3DVertexBuffer7_QueryInterface(ICOM_INTERFACE(This, IDirect3DVertexBuffer7), return IDirect3DVertexBuffer7_QueryInterface((IDirect3DVertexBuffer7 *)This, riid, obj);
riid,
obj);
} }
/***************************************************************************** /*****************************************************************************
@ -139,7 +137,7 @@ Thunk_IDirect3DVertexBufferImpl_1_AddRef(IDirect3DVertexBuffer *iface)
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface); ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", This); 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); ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", This); 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); ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%p,%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, Flags, Data, Size); TRACE_(ddraw_thunk)("(%p)->(%08x,%p,%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, Flags, Data, Size);
return IDirect3DVertexBuffer7_Lock(ICOM_INTERFACE(This, IDirect3DVertexBuffer7), return IDirect3DVertexBuffer7_Lock((IDirect3DVertexBuffer7 *)This, Flags, Data, Size);
Flags,
Data,
Size);
} }
/***************************************************************************** /*****************************************************************************
@ -309,7 +304,7 @@ Thunk_IDirect3DVertexBufferImpl_1_Unlock(IDirect3DVertexBuffer *iface)
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface); ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", This); 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); 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), return IDirect3DVertexBuffer7_ProcessVertices((IDirect3DVertexBuffer7 *)This, VertexOp, DestIndex,
VertexOp, Count, (IDirect3DVertexBuffer7 *)Src, SrcIndex, (IDirect3DDevice7 *)D3D, Flags);
DestIndex,
Count,
ICOM_INTERFACE(Src, IDirect3DVertexBuffer7),
SrcIndex,
ICOM_INTERFACE(D3D, IDirect3DDevice7),
Flags);
} }
/***************************************************************************** /*****************************************************************************
@ -484,8 +473,7 @@ Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc(IDirect3DVertexBuffer *ifa
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface); ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, Desc); TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, Desc);
return IDirect3DVertexBuffer7_GetVertexBufferDesc(ICOM_INTERFACE(This, IDirect3DVertexBuffer7), return IDirect3DVertexBuffer7_GetVertexBufferDesc((IDirect3DVertexBuffer7 *)This, Desc);
Desc);
} }
@ -536,9 +524,7 @@ Thunk_IDirect3DVertexBufferImpl_1_Optimize(IDirect3DVertexBuffer *iface,
IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice3, D3DDevice); IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice3, D3DDevice);
TRACE_(ddraw_thunk)("(%p)->(%p,%08x) thunking to IDirect3DVertexBuffer7 interface.\n", This, D3D, Flags); TRACE_(ddraw_thunk)("(%p)->(%p,%08x) thunking to IDirect3DVertexBuffer7 interface.\n", This, D3D, Flags);
return IDirect3DVertexBuffer7_Optimize(ICOM_INTERFACE(This, IDirect3DVertexBuffer7), return IDirect3DVertexBuffer7_Optimize((IDirect3DVertexBuffer7 *)This, (IDirect3DDevice7 *)D3D, Flags);
ICOM_INTERFACE(D3D, IDirect3DDevice7),
Flags);
} }
/***************************************************************************** /*****************************************************************************

View File

@ -86,7 +86,7 @@ void viewport_activate(IDirect3DViewportImpl* This, BOOL ignore_lights) {
} }
/* And also set the viewport */ /* 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, REFIID riid,
void **obp) void **obp)
{ {
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface); TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), obp);
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), obp);
*obp = NULL; *obp = NULL;
@ -157,12 +156,12 @@ IDirect3DViewportImpl_QueryInterface(IDirect3DViewport3 *iface,
IsEqualGUID(&IID_IDirect3DViewport, riid) || IsEqualGUID(&IID_IDirect3DViewport, riid) ||
IsEqualGUID(&IID_IDirect3DViewport2, riid) || IsEqualGUID(&IID_IDirect3DViewport2, riid) ||
IsEqualGUID(&IID_IDirect3DViewport3, riid) ) { IsEqualGUID(&IID_IDirect3DViewport3, riid) ) {
IDirect3DViewport3_AddRef(ICOM_INTERFACE(This, IDirect3DViewport3)); IDirect3DViewport3_AddRef(iface);
*obp = ICOM_INTERFACE(This, IDirect3DViewport3); *obp = iface;
TRACE(" Creating IDirect3DViewport1/2/3 interface %p\n", *obp); TRACE(" Creating IDirect3DViewport1/2/3 interface %p\n", *obp);
return S_OK; 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; return E_NOINTERFACE;
} }
@ -312,7 +311,8 @@ IDirect3DViewportImpl_SetViewport(IDirect3DViewport3 *iface,
This->viewports.vp1.dvMaxZ = 1.0; This->viewports.vp1.dvMaxZ = 1.0;
if (This->active_device) { 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 (current_viewport) {
if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This) if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
This->activate(This, FALSE); This->activate(This, FALSE);
@ -668,12 +668,14 @@ IDirect3DViewportImpl_Clear(IDirect3DViewport3 *iface,
DWORD color = 0x00000000; DWORD color = 0x00000000;
HRESULT hr; HRESULT hr;
LPDIRECT3DVIEWPORT3 current_viewport; LPDIRECT3DVIEWPORT3 current_viewport;
IDirect3DDevice3 *d3d_device3;
TRACE("(%p/%p)->(%08x,%p,%08x)\n", This, iface, dwCount, lpRects, dwFlags); TRACE("(%p/%p)->(%08x,%p,%08x)\n", This, iface, dwCount, lpRects, dwFlags);
if (This->active_device == NULL) { if (This->active_device == NULL) {
ERR(" Trying to clear a viewport not attached to a device !\n"); ERR(" Trying to clear a viewport not attached to a device !\n");
return D3DERR_VIEWPORTHASNODEVICE; return D3DERR_VIEWPORTHASNODEVICE;
} }
d3d_device3 = (IDirect3DDevice3 *)&This->active_device->IDirect3DDevice3_vtbl;
EnterCriticalSection(&ddraw_cs); EnterCriticalSection(&ddraw_cs);
if (dwFlags & D3DCLEAR_TARGET) { if (dwFlags & D3DCLEAR_TARGET) {
@ -692,15 +694,10 @@ IDirect3DViewportImpl_Clear(IDirect3DViewport3 *iface,
afterwards. */ afterwards. */
This->activate(This, TRUE); This->activate(This, TRUE);
hr = IDirect3DDevice7_Clear(ICOM_INTERFACE(This->active_device, IDirect3DDevice7), hr = IDirect3DDevice7_Clear((IDirect3DDevice7 *)This->active_device, dwCount, lpRects,
dwCount, dwFlags & (D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET), color, 1.0, 0x00000000);
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) { if(current_viewport) {
IDirect3DViewportImpl *vp = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport); IDirect3DViewportImpl *vp = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport);
vp->activate(vp, TRUE); vp->activate(vp, TRUE);
@ -915,7 +912,8 @@ IDirect3DViewportImpl_SetViewport2(IDirect3DViewport3 *iface,
memcpy(&(This->viewports.vp2), lpData, lpData->dwSize); memcpy(&(This->viewports.vp2), lpData, lpData->dwSize);
if (This->active_device) { 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 (current_viewport) {
if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This) if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
This->activate(This, FALSE); This->activate(This, FALSE);
@ -1003,6 +1001,7 @@ IDirect3DViewportImpl_Clear2(IDirect3DViewport3 *iface,
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface); ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
HRESULT hr; HRESULT hr;
LPDIRECT3DVIEWPORT3 current_viewport; LPDIRECT3DVIEWPORT3 current_viewport;
IDirect3DDevice3 *d3d_device3;
TRACE("(%p)->(%08x,%p,%08x,%08x,%f,%08x)\n", This, dwCount, lpRects, dwFlags, dwColor, dvZ, dwStencil); TRACE("(%p)->(%08x,%p,%08x,%08x,%f,%08x)\n", This, dwCount, lpRects, dwFlags, dwColor, dvZ, dwStencil);
EnterCriticalSection(&ddraw_cs); EnterCriticalSection(&ddraw_cs);
@ -1011,18 +1010,14 @@ IDirect3DViewportImpl_Clear2(IDirect3DViewport3 *iface,
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return D3DERR_VIEWPORTHASNODEVICE; 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 /* Need to temporarily activate viewport to clear it. Previously active one will be restored
afterwards. */ afterwards. */
This->activate(This, TRUE); This->activate(This, TRUE);
hr = IDirect3DDevice7_Clear(ICOM_INTERFACE(This->active_device, IDirect3DDevice7), hr = IDirect3DDevice7_Clear((IDirect3DDevice7 *)This->active_device,
dwCount, dwCount, lpRects, dwFlags, dwColor, dvZ, dwStencil);
lpRects, IDirect3DDevice3_GetCurrentViewport(d3d_device3, &current_viewport);
dwFlags,
dwColor,
dvZ,
dwStencil);
IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), &current_viewport);
if(current_viewport) { if(current_viewport) {
IDirect3DViewportImpl *vp = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport); IDirect3DViewportImpl *vp = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport);
vp->activate(vp, TRUE); vp->activate(vp, TRUE);