ddraw: Get rid of ICOM_INIT_INTERFACE.

This commit is contained in:
Henri Verbeet 2009-01-21 09:56:13 +01:00 committed by Alexandre Julliard
parent 4e38c2e943
commit ad171b143f
5 changed files with 34 additions and 41 deletions

View File

@ -42,11 +42,6 @@
#define ICOM_INTERFACE(implobj, iface) \
((iface *)(implobj == NULL ? NULL :&((implobj)->ICOM_VFIELD_MULTI_NAME(iface))))
#define ICOM_INIT_INTERFACE(implobj, ifacename, vtblname) \
do { \
(implobj)->ICOM_VFIELD_MULTI_NAME(ifacename) = &(vtblname); \
} while (0)
#define COM_INTERFACE_CAST(impltype, ifnamefrom, ifnameto, ifaceptr) \
ICOM_INTERFACE(ICOM_OBJECT(impltype, ifnamefrom, ifaceptr), ifnameto)

View File

@ -1728,7 +1728,7 @@ IDirectDrawImpl_RecreateSurfacesCallback(IDirectDrawSurface7 *surf,
* new surface
*/
parImpl = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parImpl));
ICOM_INIT_INTERFACE(parImpl, IParent, IParent_Vtbl);
parImpl->IParent_vtbl = &IParent_Vtbl;
parImpl->ref = 1;
Parent = (IUnknown *) parImpl;
@ -1997,11 +1997,11 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
ERR("(%p) Error allocating memory for a surface\n", This);
return DDERR_OUTOFVIDEOMEMORY;
}
ICOM_INIT_INTERFACE(*ppSurf, IDirectDrawSurface7, IDirectDrawSurface7_Vtbl);
ICOM_INIT_INTERFACE(*ppSurf, IDirectDrawSurface3, IDirectDrawSurface3_Vtbl);
ICOM_INIT_INTERFACE(*ppSurf, IDirectDrawGammaControl, IDirectDrawGammaControl_Vtbl);
ICOM_INIT_INTERFACE(*ppSurf, IDirect3DTexture2, IDirect3DTexture2_Vtbl);
ICOM_INIT_INTERFACE(*ppSurf, IDirect3DTexture, IDirect3DTexture1_Vtbl);
(*ppSurf)->IDirectDrawSurface7_vtbl = &IDirectDrawSurface7_Vtbl;
(*ppSurf)->IDirectDrawSurface3_vtbl = &IDirectDrawSurface3_Vtbl;
(*ppSurf)->IDirectDrawGammaControl_vtbl = &IDirectDrawGammaControl_Vtbl;
(*ppSurf)->IDirect3DTexture2_vtbl = &IDirect3DTexture2_Vtbl;
(*ppSurf)->IDirect3DTexture_vtbl = &IDirect3DTexture1_Vtbl;
(*ppSurf)->ref = 1;
(*ppSurf)->version = 7;
TRACE("%p->version = %d\n", (*ppSurf), (*ppSurf)->version);
@ -2036,7 +2036,7 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
return DDERR_OUTOFMEMORY;
}
parImpl->ref = 1;
ICOM_INIT_INTERFACE(parImpl, IParent, IParent_Vtbl);
parImpl->IParent_vtbl = &IParent_Vtbl;
Parent = (IUnknown *) ICOM_INTERFACE(parImpl, IParent);
TRACE("Using IParent interface %p as parent\n", parImpl);
}
@ -3140,7 +3140,7 @@ DirectDrawCreateClipper(DWORD Flags,
return E_OUTOFMEMORY;
}
ICOM_INIT_INTERFACE(object, IDirectDrawClipper, IDirectDrawClipper_Vtbl);
object->IDirectDrawClipper_vtbl = &IDirectDrawClipper_Vtbl;
object->ref = 1;
object->wineD3DClipper = pWineDirect3DCreateClipper((IUnknown *) object);
if(!object->wineD3DClipper)
@ -3225,7 +3225,7 @@ IDirectDrawImpl_CreatePalette(IDirectDraw7 *iface,
return E_OUTOFMEMORY;
}
ICOM_INIT_INTERFACE(object, IDirectDrawPalette, IDirectDrawPalette_Vtbl);
object->IDirectDrawPalette_vtbl = &IDirectDrawPalette_Vtbl;
object->ref = 1;
object->ddraw_owner = This;
@ -3608,7 +3608,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
return DDERR_OUTOFVIDEOMEMORY;
}
ICOM_INIT_INTERFACE(object, IParent, IParent_Vtbl);
object->IParent_vtbl = &IParent_Vtbl;
object->ref = 1;
hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters,

View File

@ -751,8 +751,7 @@ IDirect3DDeviceImpl_1_CreateExecuteBuffer(IDirect3DDevice *iface,
return DDERR_OUTOFMEMORY;
}
ICOM_INIT_INTERFACE(object, IDirect3DExecuteBuffer, IDirect3DExecuteBuffer_Vtbl);
object->IDirect3DExecuteBuffer_vtbl = &IDirect3DExecuteBuffer_Vtbl;
object->ref = 1;
object->d3ddev = This;

View File

@ -442,7 +442,7 @@ IDirect3DImpl_3_CreateLight(IDirect3D3 *iface,
if (object == NULL)
return DDERR_OUTOFMEMORY;
ICOM_INIT_INTERFACE(object, IDirect3DLight, IDirect3DLight_Vtbl);
object->IDirect3DLight_vtbl = &IDirect3DLight_Vtbl;
object->ref = 1;
object->ddraw = This;
object->next = NULL;
@ -522,9 +522,9 @@ IDirect3DImpl_3_CreateMaterial(IDirect3D3 *iface,
if (object == NULL)
return DDERR_OUTOFMEMORY;
ICOM_INIT_INTERFACE(object, IDirect3DMaterial3, IDirect3DMaterial3_Vtbl);
ICOM_INIT_INTERFACE(object, IDirect3DMaterial2, IDirect3DMaterial2_Vtbl);
ICOM_INIT_INTERFACE(object, IDirect3DMaterial, IDirect3DMaterial_Vtbl);
object->IDirect3DMaterial3_vtbl = &IDirect3DMaterial3_Vtbl;
object->IDirect3DMaterial2_vtbl = &IDirect3DMaterial2_Vtbl;
object->IDirect3DMaterial_vtbl = &IDirect3DMaterial_Vtbl;
object->ref = 1;
object->ddraw = This;
object->activate = material_activate;
@ -613,7 +613,7 @@ IDirect3DImpl_3_CreateViewport(IDirect3D3 *iface,
if (object == NULL)
return DDERR_OUTOFMEMORY;
ICOM_INIT_INTERFACE(object, IDirect3DViewport3, IDirect3DViewport3_Vtbl);
object->IDirect3DViewport3_vtbl = &IDirect3DViewport3_Vtbl;
object->ref = 1;
object->ddraw = This;
object->activate = viewport_activate;
@ -806,14 +806,13 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
}
if (This->cooperative_level & DDSCL_FPUPRESERVE)
ICOM_INIT_INTERFACE(object, IDirect3DDevice7, IDirect3DDevice7_FPUPreserve_Vtbl);
object->IDirect3DDevice7_vtbl = &IDirect3DDevice7_FPUPreserve_Vtbl;
else
ICOM_INIT_INTERFACE(object, IDirect3DDevice7, IDirect3DDevice7_FPUSetup_Vtbl);
ICOM_INIT_INTERFACE(object, IDirect3DDevice3, IDirect3DDevice3_Vtbl);
ICOM_INIT_INTERFACE(object, IDirect3DDevice2, IDirect3DDevice2_Vtbl);
ICOM_INIT_INTERFACE(object, IDirect3DDevice, IDirect3DDevice1_Vtbl);
object->IDirect3DDevice7_vtbl = &IDirect3DDevice7_FPUSetup_Vtbl;
object->IDirect3DDevice3_vtbl = &IDirect3DDevice3_Vtbl;
object->IDirect3DDevice2_vtbl = &IDirect3DDevice2_Vtbl;
object->IDirect3DDevice_vtbl = &IDirect3DDevice1_Vtbl;
object->ref = 1;
object->ddraw = This;
object->viewport_list = NULL;
@ -838,7 +837,7 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
LeaveCriticalSection(&ddraw_cs);
return DDERR_OUTOFMEMORY;
}
ICOM_INIT_INTERFACE(IndexBufferParent, IParent, IParent_Vtbl);
IndexBufferParent->IParent_vtbl = &IParent_Vtbl;
IndexBufferParent->ref = 1;
/* Create an Index Buffer. WineD3D needs one for Drawing indexed primitives
@ -1043,8 +1042,8 @@ IDirect3DImpl_7_CreateVertexBuffer(IDirect3D7 *iface,
}
object->ref = 1;
ICOM_INIT_INTERFACE(object, IDirect3DVertexBuffer7, IDirect3DVertexBuffer7_Vtbl);
ICOM_INIT_INTERFACE(object, IDirect3DVertexBuffer, IDirect3DVertexBuffer1_Vtbl);
object->IDirect3DVertexBuffer7_vtbl = &IDirect3DVertexBuffer7_Vtbl;
object->IDirect3DVertexBuffer_vtbl = &IDirect3DVertexBuffer1_Vtbl;
object->Caps = Desc->dwCaps;
object->ddraw = This;

View File

@ -171,15 +171,15 @@ DDRAW_Create(const GUID *guid,
* IDirectDraw and IDirect3D are the same object,
* QueryInterface is used to get other interfaces.
*/
ICOM_INIT_INTERFACE(This, IDirectDraw, IDirectDraw1_Vtbl);
ICOM_INIT_INTERFACE(This, IDirectDraw2, IDirectDraw2_Vtbl);
ICOM_INIT_INTERFACE(This, IDirectDraw3, IDirectDraw3_Vtbl);
ICOM_INIT_INTERFACE(This, IDirectDraw4, IDirectDraw4_Vtbl);
ICOM_INIT_INTERFACE(This, IDirectDraw7, IDirectDraw7_Vtbl);
ICOM_INIT_INTERFACE(This, IDirect3D, IDirect3D1_Vtbl);
ICOM_INIT_INTERFACE(This, IDirect3D2, IDirect3D2_Vtbl);
ICOM_INIT_INTERFACE(This, IDirect3D3, IDirect3D3_Vtbl);
ICOM_INIT_INTERFACE(This, IDirect3D7, IDirect3D7_Vtbl);
This->IDirectDraw_vtbl = &IDirectDraw1_Vtbl;
This->IDirectDraw2_vtbl = &IDirectDraw2_Vtbl;
This->IDirectDraw3_vtbl = &IDirectDraw3_Vtbl;
This->IDirectDraw4_vtbl = &IDirectDraw4_Vtbl;
This->IDirectDraw7_vtbl = &IDirectDraw7_Vtbl;
This->IDirect3D_vtbl = &IDirect3D1_Vtbl;
This->IDirect3D2_vtbl = &IDirect3D2_Vtbl;
This->IDirect3D3_vtbl = &IDirect3D3_Vtbl;
This->IDirect3D7_vtbl = &IDirect3D7_Vtbl;
This->device_parent_vtbl = &ddraw_wined3d_device_parent_vtbl;
/* See comments in IDirectDrawImpl_CreateNewSurface for a description
@ -700,7 +700,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
factory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*factory));
if (factory == NULL) return E_OUTOFMEMORY;
ICOM_INIT_INTERFACE(factory, IClassFactory, IClassFactory_Vtbl);
factory->IClassFactory_vtbl = &IClassFactory_Vtbl;
factory->ref = 1;
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;