Commit 8c4cc2af authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Get rid of ICOM_THIS_FROM.

parent 08e3742f
......@@ -27,9 +27,6 @@
(impltype*)((ifaceptr) == NULL ? NULL \
: (char*)(ifaceptr) - offsetof(impltype, ifacename##_vtbl))
#define ICOM_THIS_FROM(impltype, ifacename, ifaceptr) \
impltype* This = ICOM_OBJECT(impltype, ifacename, ifaceptr)
#define COM_INTERFACE_CAST(impltype, ifnamefrom, ifnameto, ifaceptr) \
((ifaceptr) ? (ifnameto *)&(((impltype *)((char *)(ifaceptr) \
- offsetof(impltype, ifnamefrom##_vtbl)))->ifnameto##_vtbl) : NULL)
......
......@@ -42,6 +42,26 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddraw_thunk);
WINE_DECLARE_DEBUG_CHANNEL(ddraw);
static inline IDirectDrawImpl *ddraw_from_ddraw1(IDirectDraw *iface)
{
return (IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawImpl, IDirectDraw_vtbl));
}
static inline IDirectDrawImpl *ddraw_from_ddraw2(IDirectDraw2 *iface)
{
return (IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawImpl, IDirectDraw2_vtbl));
}
static inline IDirectDrawImpl *ddraw_from_ddraw3(IDirectDraw3 *iface)
{
return (IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawImpl, IDirectDraw3_vtbl));
}
static inline IDirectDrawImpl *ddraw_from_ddraw4(IDirectDraw4 *iface)
{
return (IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawImpl, IDirectDraw4_vtbl));
}
static HRESULT WINAPI
IDirectDrawImpl_QueryInterface(LPDIRECTDRAW This, REFIID iid, LPVOID *ppObj)
{
......@@ -81,7 +101,7 @@ IDirectDraw4Impl_QueryInterface(LPDIRECTDRAW4 This, REFIID iid, LPVOID *ppObj)
static ULONG WINAPI
IDirectDrawImpl_AddRef(LPDIRECTDRAW iface)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw, iface);
IDirectDrawImpl *This = ddraw_from_ddraw1(iface);
ULONG ref = InterlockedIncrement(&This->ref1);
TRACE("(%p) : incrementing IDirectDraw refcount from %u.\n", This, ref -1);
......@@ -94,7 +114,7 @@ IDirectDrawImpl_AddRef(LPDIRECTDRAW iface)
static ULONG WINAPI
IDirectDraw2Impl_AddRef(LPDIRECTDRAW2 iface)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw2, iface);
IDirectDrawImpl *This = ddraw_from_ddraw2(iface);
ULONG ref = InterlockedIncrement(&This->ref2);
TRACE("(%p) : incrementing IDirectDraw2 refcount from %u.\n", This, ref -1);
......@@ -107,7 +127,7 @@ IDirectDraw2Impl_AddRef(LPDIRECTDRAW2 iface)
static ULONG WINAPI
IDirectDraw3Impl_AddRef(LPDIRECTDRAW3 iface)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw3, iface);
IDirectDrawImpl *This = ddraw_from_ddraw3(iface);
ULONG ref = InterlockedIncrement(&This->ref3);
TRACE("(%p) : incrementing IDirectDraw3 refcount from %u.\n", This, ref -1);
......@@ -120,7 +140,7 @@ IDirectDraw3Impl_AddRef(LPDIRECTDRAW3 iface)
static ULONG WINAPI
IDirectDraw4Impl_AddRef(LPDIRECTDRAW4 iface)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw4, iface);
IDirectDrawImpl *This = ddraw_from_ddraw4(iface);
ULONG ref = InterlockedIncrement(&This->ref4);
TRACE("(%p) : incrementing IDirectDraw4 refcount from %u.\n", This, ref -1);
......@@ -133,7 +153,7 @@ IDirectDraw4Impl_AddRef(LPDIRECTDRAW4 iface)
static ULONG WINAPI
IDirectDrawImpl_Release(LPDIRECTDRAW iface)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw, iface);
IDirectDrawImpl *This = ddraw_from_ddraw1(iface);
ULONG ref = InterlockedDecrement(&This->ref1);
TRACE_(ddraw)("(%p)->() decrementing IDirectDraw refcount from %u.\n", This, ref +1);
......@@ -150,7 +170,7 @@ IDirectDrawImpl_Release(LPDIRECTDRAW iface)
static ULONG WINAPI
IDirectDraw2Impl_Release(LPDIRECTDRAW2 iface)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw2, iface);
IDirectDrawImpl *This = ddraw_from_ddraw2(iface);
ULONG ref = InterlockedDecrement(&This->ref2);
TRACE_(ddraw)("(%p)->() decrementing IDirectDraw2 refcount from %u.\n", This, ref +1);
......@@ -167,7 +187,7 @@ IDirectDraw2Impl_Release(LPDIRECTDRAW2 iface)
static ULONG WINAPI
IDirectDraw3Impl_Release(LPDIRECTDRAW3 iface)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw3, iface);
IDirectDrawImpl *This = ddraw_from_ddraw3(iface);
ULONG ref = InterlockedDecrement(&This->ref3);
TRACE_(ddraw)("(%p)->() decrementing IDirectDraw3 refcount from %u.\n", This, ref +1);
......@@ -184,7 +204,7 @@ IDirectDraw3Impl_Release(LPDIRECTDRAW3 iface)
static ULONG WINAPI
IDirectDraw4Impl_Release(LPDIRECTDRAW4 iface)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw4, iface);
IDirectDrawImpl *This = ddraw_from_ddraw4(iface);
ULONG ref = InterlockedDecrement(&This->ref4);
TRACE_(ddraw)("(%p)->() decrementing IDirectDraw4 refcount from %u.\n", This, ref +1);
......@@ -1123,7 +1143,7 @@ IDirectDraw4Impl_GetVerticalBlankStatus(LPDIRECTDRAW4 This, LPBOOL lpbIsInVB)
static HRESULT WINAPI
IDirectDrawImpl_Initialize(LPDIRECTDRAW iface, LPGUID pGUID)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw, iface);
IDirectDrawImpl *This = ddraw_from_ddraw1(iface);
HRESULT ret_value;
ret_value = IDirectDraw7_Initialize((IDirectDraw7 *)This, pGUID);
......@@ -1134,7 +1154,7 @@ IDirectDrawImpl_Initialize(LPDIRECTDRAW iface, LPGUID pGUID)
static HRESULT WINAPI
IDirectDraw2Impl_Initialize(LPDIRECTDRAW2 iface, LPGUID pGUID)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw2, iface);
IDirectDrawImpl *This = ddraw_from_ddraw2(iface);
HRESULT ret_value;
ret_value = IDirectDraw7_Initialize((IDirectDraw7 *)This, pGUID);
......@@ -1145,7 +1165,7 @@ IDirectDraw2Impl_Initialize(LPDIRECTDRAW2 iface, LPGUID pGUID)
static HRESULT WINAPI
IDirectDraw3Impl_Initialize(LPDIRECTDRAW3 iface, LPGUID pGUID)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw3, iface);
IDirectDrawImpl *This = ddraw_from_ddraw3(iface);
HRESULT ret_value;
ret_value = IDirectDraw7_Initialize((IDirectDraw7 *)This, pGUID);
......@@ -1156,7 +1176,7 @@ IDirectDraw3Impl_Initialize(LPDIRECTDRAW3 iface, LPGUID pGUID)
static HRESULT WINAPI
IDirectDraw4Impl_Initialize(LPDIRECTDRAW4 iface, LPGUID pGUID)
{
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw4, iface);
IDirectDrawImpl *This = ddraw_from_ddraw4(iface);
HRESULT ret_value;
ret_value = IDirectDraw7_Initialize((IDirectDraw7 *)This, pGUID);
......
......@@ -624,7 +624,7 @@ IDirect3DExecuteBufferImpl_QueryInterface(IDirect3DExecuteBuffer *iface,
static ULONG WINAPI
IDirect3DExecuteBufferImpl_AddRef(IDirect3DExecuteBuffer *iface)
{
ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface);
IDirect3DExecuteBufferImpl *This = (IDirect3DExecuteBufferImpl *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
FIXME("(%p)->()incrementing from %u.\n", This, ref - 1);
......@@ -644,7 +644,7 @@ IDirect3DExecuteBufferImpl_AddRef(IDirect3DExecuteBuffer *iface)
static ULONG WINAPI
IDirect3DExecuteBufferImpl_Release(IDirect3DExecuteBuffer *iface)
{
ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface);
IDirect3DExecuteBufferImpl *This = (IDirect3DExecuteBufferImpl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->()decrementing from %u.\n", This, ref + 1);
......@@ -676,7 +676,7 @@ IDirect3DExecuteBufferImpl_Initialize(IDirect3DExecuteBuffer *iface,
IDirect3DDevice *lpDirect3DDevice,
D3DEXECUTEBUFFERDESC *lpDesc)
{
ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface);
IDirect3DExecuteBufferImpl *This = (IDirect3DExecuteBufferImpl *)iface;
TRACE("(%p)->(%p,%p) no-op....\n", This, lpDirect3DDevice, lpDesc);
return D3D_OK;
}
......@@ -698,7 +698,7 @@ static HRESULT WINAPI
IDirect3DExecuteBufferImpl_Lock(IDirect3DExecuteBuffer *iface,
D3DEXECUTEBUFFERDESC *lpDesc)
{
ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface);
IDirect3DExecuteBufferImpl *This = (IDirect3DExecuteBufferImpl *)iface;
DWORD dwSize;
TRACE("(%p)->(%p)\n", This, lpDesc);
......@@ -725,7 +725,7 @@ IDirect3DExecuteBufferImpl_Lock(IDirect3DExecuteBuffer *iface,
static HRESULT WINAPI
IDirect3DExecuteBufferImpl_Unlock(IDirect3DExecuteBuffer *iface)
{
ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface);
IDirect3DExecuteBufferImpl *This = (IDirect3DExecuteBufferImpl *)iface;
TRACE("(%p)->() no-op...\n", This);
return D3D_OK;
}
......@@ -748,7 +748,7 @@ static HRESULT WINAPI
IDirect3DExecuteBufferImpl_SetExecuteData(IDirect3DExecuteBuffer *iface,
D3DEXECUTEDATA *lpData)
{
ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface);
IDirect3DExecuteBufferImpl *This = (IDirect3DExecuteBufferImpl *)iface;
DWORD nbvert;
TRACE("(%p)->(%p)\n", This, lpData);
......@@ -784,7 +784,7 @@ static HRESULT WINAPI
IDirect3DExecuteBufferImpl_GetExecuteData(IDirect3DExecuteBuffer *iface,
D3DEXECUTEDATA *lpData)
{
ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface);
IDirect3DExecuteBufferImpl *This = (IDirect3DExecuteBufferImpl *)iface;
DWORD dwSize;
TRACE("(%p)->(%p): stub!\n", This, lpData);
......@@ -820,7 +820,7 @@ IDirect3DExecuteBufferImpl_Validate(IDirect3DExecuteBuffer *iface,
void *UserArg,
DWORD Reserved)
{
ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface);
IDirect3DExecuteBufferImpl *This = (IDirect3DExecuteBufferImpl *)iface;
TRACE("(%p)->(%p,%p,%p,%08x): Unimplemented!\n", This, Offset, Func, UserArg, Reserved);
return DDERR_UNSUPPORTED; /* Unchecked */
}
......@@ -842,7 +842,7 @@ static HRESULT WINAPI
IDirect3DExecuteBufferImpl_Optimize(IDirect3DExecuteBuffer *iface,
DWORD Dummy)
{
ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface);
IDirect3DExecuteBufferImpl *This = (IDirect3DExecuteBufferImpl *)iface;
TRACE("(%p)->(%08x): Unimplemented\n", This, Dummy);
return DDERR_UNSUPPORTED; /* Unchecked */
}
......
......@@ -43,6 +43,12 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
WINE_DECLARE_DEBUG_CHANNEL(ddraw_thunk);
static inline IDirectDrawSurfaceImpl *surface_from_gamma_control(IDirectDrawGammaControl *iface)
{
return (IDirectDrawSurfaceImpl *)((char*)iface
- FIELD_OFFSET(IDirectDrawSurfaceImpl, IDirectDrawGammaControl_vtbl));
}
/**********************************************************
* IUnknown parts follow
**********************************************************/
......@@ -64,7 +70,7 @@ static HRESULT WINAPI
IDirectDrawGammaControlImpl_QueryInterface(IDirectDrawGammaControl *iface, REFIID riid,
void **obj)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawGammaControl, iface);
IDirectDrawSurfaceImpl *This = surface_from_gamma_control(iface);
TRACE_(ddraw_thunk)("(%p)->(%s,%p): Thunking to IDirectDrawSurface7\n", This, debugstr_guid(riid), obj);
return IDirectDrawSurface7_QueryInterface((IDirectDrawSurface7 *)This, riid, obj);
......@@ -82,7 +88,7 @@ IDirectDrawGammaControlImpl_QueryInterface(IDirectDrawGammaControl *iface, REFII
static ULONG WINAPI
IDirectDrawGammaControlImpl_AddRef(IDirectDrawGammaControl *iface)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawGammaControl, iface);
IDirectDrawSurfaceImpl *This = surface_from_gamma_control(iface);
TRACE_(ddraw_thunk)("(%p)->() Thunking to IDirectDrawSurface7\n", This);
return IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)This);
......@@ -100,7 +106,7 @@ IDirectDrawGammaControlImpl_AddRef(IDirectDrawGammaControl *iface)
static ULONG WINAPI
IDirectDrawGammaControlImpl_Release(IDirectDrawGammaControl *iface)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawGammaControl, iface);
IDirectDrawSurfaceImpl *This = surface_from_gamma_control(iface);
TRACE_(ddraw_thunk)("(%p)->() Thunking to IDirectDrawSurface7\n", This);
return IDirectDrawSurface7_Release((IDirectDrawSurface7 *)This);
......@@ -129,7 +135,7 @@ IDirectDrawGammaControlImpl_GetGammaRamp(IDirectDrawGammaControl *iface,
DWORD Flags,
DDGAMMARAMP *GammaRamp)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawGammaControl, iface);
IDirectDrawSurfaceImpl *This = surface_from_gamma_control(iface);
TRACE("(%p)->(%08x,%p)\n", This,Flags,GammaRamp);
/* This looks sane */
......@@ -175,7 +181,7 @@ IDirectDrawGammaControlImpl_SetGammaRamp(IDirectDrawGammaControl *iface,
DWORD Flags,
DDGAMMARAMP *GammaRamp)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawGammaControl, iface);
IDirectDrawSurfaceImpl *This = surface_from_gamma_control(iface);
TRACE("(%p)->(%08x,%p)\n", This,Flags,GammaRamp);
/* This looks sane */
......
......@@ -65,7 +65,7 @@ IDirect3DLightImpl_QueryInterface(IDirect3DLight *iface,
REFIID riid,
void **obp)
{
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
IDirect3DLightImpl *This = (IDirect3DLightImpl *)iface;
FIXME("(%p)->(%s,%p): stub!\n", This, debugstr_guid(riid), obp);
*obp = NULL;
return E_NOINTERFACE;
......@@ -83,7 +83,7 @@ IDirect3DLightImpl_QueryInterface(IDirect3DLight *iface,
static ULONG WINAPI
IDirect3DLightImpl_AddRef(IDirect3DLight *iface)
{
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
IDirect3DLightImpl *This = (IDirect3DLightImpl *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->() incrementing from %u.\n", This, ref - 1);
......@@ -104,7 +104,7 @@ IDirect3DLightImpl_AddRef(IDirect3DLight *iface)
static ULONG WINAPI
IDirect3DLightImpl_Release(IDirect3DLight *iface)
{
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
IDirect3DLightImpl *This = (IDirect3DLightImpl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->() decrementing from %u.\n", This, ref + 1);
......@@ -137,7 +137,7 @@ static HRESULT WINAPI
IDirect3DLightImpl_Initialize(IDirect3DLight *iface,
IDirect3D *lpDirect3D)
{
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
IDirect3DLightImpl *This = (IDirect3DLightImpl *)iface;
IDirectDrawImpl *d3d = ICOM_OBJECT(IDirectDrawImpl, IDirect3D, lpDirect3D);
TRACE("(%p)->(%p) no-op...\n", This, d3d);
return D3D_OK;
......@@ -169,7 +169,7 @@ static HRESULT WINAPI
IDirect3DLightImpl_SetLight(IDirect3DLight *iface,
D3DLIGHT *lpLight)
{
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
IDirect3DLightImpl *This = (IDirect3DLightImpl *)iface;
LPD3DLIGHT7 light7 = &(This->light7);
TRACE("(%p)->(%p)\n", This, lpLight);
if (TRACE_ON(d3d7)) {
......@@ -226,7 +226,7 @@ static HRESULT WINAPI
IDirect3DLightImpl_GetLight(IDirect3DLight *iface,
D3DLIGHT *lpLight)
{
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
IDirect3DLightImpl *This = (IDirect3DLightImpl *)iface;
TRACE("(%p/%p)->(%p)\n", This, iface, lpLight);
if (TRACE_ON(d3d7)) {
TRACE(" Returning light definition :\n");
......
......@@ -539,7 +539,7 @@ IDirectDrawClassFactoryImpl_QueryInterface(IClassFactory *iface,
REFIID riid,
void **obj)
{
ICOM_THIS_FROM(IClassFactoryImpl, IClassFactory, iface);
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), obj);
......@@ -567,7 +567,7 @@ IDirectDrawClassFactoryImpl_QueryInterface(IClassFactory *iface,
static ULONG WINAPI
IDirectDrawClassFactoryImpl_AddRef(IClassFactory *iface)
{
ICOM_THIS_FROM(IClassFactoryImpl, IClassFactory, iface);
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->() incrementing from %d.\n", This, ref - 1);
......@@ -588,7 +588,7 @@ IDirectDrawClassFactoryImpl_AddRef(IClassFactory *iface)
static ULONG WINAPI
IDirectDrawClassFactoryImpl_Release(IClassFactory *iface)
{
ICOM_THIS_FROM(IClassFactoryImpl, IClassFactory, iface);
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->() decrementing from %d.\n", This, ref+1);
......@@ -617,7 +617,7 @@ IDirectDrawClassFactoryImpl_CreateInstance(IClassFactory *iface,
REFIID riid,
void **obj)
{
ICOM_THIS_FROM(IClassFactoryImpl, IClassFactory, iface);
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE("(%p)->(%p,%s,%p)\n",This,UnkOuter,debugstr_guid(riid),obj);
......@@ -639,7 +639,7 @@ IDirectDrawClassFactoryImpl_CreateInstance(IClassFactory *iface,
static HRESULT WINAPI
IDirectDrawClassFactoryImpl_LockServer(IClassFactory *iface,BOOL dolock)
{
ICOM_THIS_FROM(IClassFactoryImpl, IClassFactory, iface);
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p)->(%d),stub!\n",This,dolock);
return S_OK;
}
......
......@@ -50,6 +50,11 @@ static void dump_material(const D3DMATERIAL *mat)
TRACE(" dwSize : %d\n", mat->dwSize);
}
static inline IDirect3DMaterialImpl *material_from_material1(IDirect3DMaterial *iface)
{
return (IDirect3DMaterialImpl *)((char*)iface - FIELD_OFFSET(IDirect3DMaterialImpl, IDirect3DMaterial_vtbl));
}
/*****************************************************************************
* IUnknown Methods.
*****************************************************************************/
......@@ -74,7 +79,7 @@ IDirect3DMaterialImpl_QueryInterface(IDirect3DMaterial3 *iface,
REFIID riid,
LPVOID* obp)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
IDirect3DMaterialImpl *This = (IDirect3DMaterialImpl *)iface;
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), obp);
*obp = NULL;
......@@ -119,7 +124,7 @@ IDirect3DMaterialImpl_QueryInterface(IDirect3DMaterial3 *iface,
static ULONG WINAPI
IDirect3DMaterialImpl_AddRef(IDirect3DMaterial3 *iface)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
IDirect3DMaterialImpl *This = (IDirect3DMaterialImpl *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->() incrementing from %u.\n", This, ref - 1);
......@@ -140,7 +145,7 @@ IDirect3DMaterialImpl_AddRef(IDirect3DMaterial3 *iface)
static ULONG WINAPI
IDirect3DMaterialImpl_Release(IDirect3DMaterial3 *iface)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
IDirect3DMaterialImpl *This = (IDirect3DMaterialImpl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->() decrementing from %u.\n", This, ref + 1);
......@@ -181,7 +186,7 @@ static HRESULT WINAPI
IDirect3DMaterialImpl_Initialize(IDirect3DMaterial *iface,
IDirect3D *Direct3D)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial, iface);
IDirect3DMaterialImpl *This = material_from_material1(iface);
TRACE("(%p)->(%p) no-op...!\n", This, Direct3D);
......@@ -201,7 +206,7 @@ IDirect3DMaterialImpl_Initialize(IDirect3DMaterial *iface,
static HRESULT WINAPI
IDirect3DMaterialImpl_Reserve(IDirect3DMaterial *iface)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial, iface);
IDirect3DMaterialImpl *This = material_from_material1(iface);
TRACE("(%p)->() not implemented\n", This);
return DDERR_UNSUPPORTED;
......@@ -219,7 +224,7 @@ IDirect3DMaterialImpl_Reserve(IDirect3DMaterial *iface)
static HRESULT WINAPI
IDirect3DMaterialImpl_Unreserve(IDirect3DMaterial *iface)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial, iface);
IDirect3DMaterialImpl *This = material_from_material1(iface);
TRACE("(%p)->() not implemented.\n", This);
return DDERR_UNSUPPORTED;
......@@ -242,7 +247,7 @@ static HRESULT WINAPI
IDirect3DMaterialImpl_SetMaterial(IDirect3DMaterial3 *iface,
D3DMATERIAL *lpMat)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
IDirect3DMaterialImpl *This = (IDirect3DMaterialImpl *)iface;
TRACE("(%p)->(%p)\n", This, lpMat);
if (TRACE_ON(d3d7))
dump_material(lpMat);
......@@ -273,7 +278,7 @@ static HRESULT WINAPI
IDirect3DMaterialImpl_GetMaterial(IDirect3DMaterial3 *iface,
D3DMATERIAL *lpMat)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
IDirect3DMaterialImpl *This = (IDirect3DMaterialImpl *)iface;
DWORD dwSize;
TRACE("(%p)->(%p)\n", This, lpMat);
if (TRACE_ON(d3d7)) {
......@@ -311,7 +316,7 @@ IDirect3DMaterialImpl_GetHandle(IDirect3DMaterial3 *iface,
IDirect3DDevice3 *lpDirect3DDevice3,
D3DMATERIALHANDLE *lpHandle)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
IDirect3DMaterialImpl *This = (IDirect3DMaterialImpl *)iface;
IDirect3DDeviceImpl *device = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice3, lpDirect3DDevice3);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, device, lpHandle);
......
......@@ -49,7 +49,7 @@ IDirectDrawPaletteImpl_QueryInterface(IDirectDrawPalette *iface,
REFIID refiid,
void **obj)
{
ICOM_THIS_FROM(IDirectDrawPaletteImpl, IDirectDrawPalette, iface);
IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(refiid),obj);
if (IsEqualGUID(refiid, &IID_IUnknown)
......@@ -78,7 +78,7 @@ IDirectDrawPaletteImpl_QueryInterface(IDirectDrawPalette *iface,
static ULONG WINAPI
IDirectDrawPaletteImpl_AddRef(IDirectDrawPalette *iface)
{
ICOM_THIS_FROM(IDirectDrawPaletteImpl, IDirectDrawPalette, iface);
IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->() incrementing from %u.\n", This, ref - 1);
......@@ -98,7 +98,7 @@ IDirectDrawPaletteImpl_AddRef(IDirectDrawPalette *iface)
static ULONG WINAPI
IDirectDrawPaletteImpl_Release(IDirectDrawPalette *iface)
{
ICOM_THIS_FROM(IDirectDrawPaletteImpl, IDirectDrawPalette, iface);
IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->() decrementing from %u.\n", This, ref + 1);
......@@ -161,7 +161,7 @@ static HRESULT WINAPI
IDirectDrawPaletteImpl_GetCaps(IDirectDrawPalette *iface,
DWORD *Caps)
{
ICOM_THIS_FROM(IDirectDrawPaletteImpl, IDirectDrawPalette, iface);
IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
HRESULT hr;
TRACE("(%p)->(%p): Relay\n", This, Caps);
......@@ -196,7 +196,7 @@ IDirectDrawPaletteImpl_SetEntries(IDirectDrawPalette *iface,
DWORD Count,
PALETTEENTRY *PalEnt)
{
ICOM_THIS_FROM(IDirectDrawPaletteImpl, IDirectDrawPalette, iface);
IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
HRESULT hr;
TRACE("(%p)->(%x,%d,%d,%p): Relay\n", This, Flags, Start, Count, PalEnt);
......@@ -233,7 +233,7 @@ IDirectDrawPaletteImpl_GetEntries(IDirectDrawPalette *iface,
DWORD Count,
PALETTEENTRY *PalEnt)
{
ICOM_THIS_FROM(IDirectDrawPaletteImpl, IDirectDrawPalette, iface);
IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
HRESULT hr;
TRACE("(%p)->(%x,%d,%d,%p): Relay\n", This, Flags, Start, Count, PalEnt);
......
......@@ -95,7 +95,7 @@ IParentImpl_QueryInterface(IParent *iface,
static ULONG WINAPI
IParentImpl_AddRef(IParent *iface)
{
ICOM_THIS_FROM(IParentImpl, IParent, iface);
IParentImpl *This = (IParentImpl *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) : AddRef from %d\n", This, ref - 1);
......@@ -120,7 +120,7 @@ IParentImpl_AddRef(IParent *iface)
static ULONG WINAPI
IParentImpl_Release(IParent *iface)
{
ICOM_THIS_FROM(IParentImpl, IParent, iface);
IParentImpl *This = (IParentImpl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
......
......@@ -44,6 +44,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddraw_thunk);
WINE_DECLARE_DEBUG_CHANNEL(ddraw);
static inline IDirectDrawSurfaceImpl *surface_from_surface3(IDirectDrawSurface3 *iface)
{
return (IDirectDrawSurfaceImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawSurfaceImpl, IDirectDrawSurface3_vtbl));
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_QueryInterface(LPDIRECTDRAWSURFACE3 This, REFIID iid,
LPVOID *ppObj)
......@@ -60,7 +65,7 @@ IDirectDrawSurface3Impl_AddRef(LPDIRECTDRAWSURFACE3 This)
static ULONG WINAPI
IDirectDrawSurface3Impl_Release(LPDIRECTDRAWSURFACE3 iface)
{
ICOM_THIS_FROM( IDirectDrawSurfaceImpl, IDirectDrawSurface3, iface);
IDirectDrawSurfaceImpl *This = surface_from_surface3(iface);
TRACE("(%p)\n", This);
return IDirectDrawSurface7_Release(CONVERT(iface));
}
......@@ -69,7 +74,7 @@ static HRESULT WINAPI
IDirectDrawSurface3Impl_AddAttachedSurface(LPDIRECTDRAWSURFACE3 iface,
LPDIRECTDRAWSURFACE3 pAttach)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawSurface3, iface);
IDirectDrawSurfaceImpl *This = surface_from_surface3(iface);
IDirectDrawSurfaceImpl *Surf = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface3, pAttach);
TRACE("(%p)->(%p)\n", This, Surf);
......@@ -303,7 +308,7 @@ static HRESULT WINAPI
IDirectDrawSurface3Impl_GetSurfaceDesc(LPDIRECTDRAWSURFACE3 iface,
LPDDSURFACEDESC pDDSD)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawSurface3, iface);
IDirectDrawSurfaceImpl *This = surface_from_surface3(iface);
TRACE_(ddraw)("(%p)->(%p)\n",This,pDDSD);
......
......@@ -45,6 +45,16 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d7);
WINE_DECLARE_DEBUG_CHANNEL(ddraw_thunk);
static inline IDirectDrawSurfaceImpl *surface_from_texture1(IDirect3DTexture *iface)
{
return (IDirectDrawSurfaceImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawSurfaceImpl, IDirect3DTexture_vtbl));
}
static inline IDirectDrawSurfaceImpl *surface_from_texture2(IDirect3DTexture2 *iface)
{
return (IDirectDrawSurfaceImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawSurfaceImpl, IDirect3DTexture2_vtbl));
}
/*****************************************************************************
* IUnknown interfaces. They are thunks to IDirectDrawSurface7
*****************************************************************************/
......@@ -53,7 +63,7 @@ Thunk_IDirect3DTextureImpl_2_QueryInterface(IDirect3DTexture2 *iface,
REFIID riid,
void **obj)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface);
IDirectDrawSurfaceImpl *This = surface_from_texture2(iface);
TRACE("(%p)->(%s,%p) thunking to IDirectDrawSurface7 interface.\n", This, debugstr_guid(riid), obj);
return IDirectDrawSurface7_QueryInterface((IDirectDrawSurface7 *)This, riid, obj);
}
......@@ -63,7 +73,7 @@ Thunk_IDirect3DTextureImpl_1_QueryInterface(IDirect3DTexture *iface,
REFIID riid,
void **obj)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture, iface);
IDirectDrawSurfaceImpl *This = surface_from_texture1(iface);
TRACE("(%p)->(%s,%p) thunking to IDirectDrawSurface7 interface.\n", This, debugstr_guid(riid), obj);
return IDirectDrawSurface7_QueryInterface((IDirectDrawSurface7 *)This, riid, obj);
......@@ -72,7 +82,7 @@ Thunk_IDirect3DTextureImpl_1_QueryInterface(IDirect3DTexture *iface,
static ULONG WINAPI
Thunk_IDirect3DTextureImpl_2_AddRef(IDirect3DTexture2 *iface)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface);
IDirectDrawSurfaceImpl *This = surface_from_texture2(iface);
TRACE("(%p)->() thunking to IDirectDrawSurface7 interface.\n", This);
return IDirectDrawSurface7_AddRef((IDirectDrawSurface7 *)This);
......@@ -81,7 +91,7 @@ Thunk_IDirect3DTextureImpl_2_AddRef(IDirect3DTexture2 *iface)
static ULONG WINAPI
Thunk_IDirect3DTextureImpl_1_AddRef(IDirect3DTexture *iface)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture, iface);
IDirectDrawSurfaceImpl *This = surface_from_texture1(iface);
TRACE("(%p)->() thunking to IDirectDrawSurface7 interface.\n", This);
return IDirectDrawSurface7_AddRef(COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirect3DTexture, IDirectDrawSurface7, iface));
......@@ -90,7 +100,7 @@ Thunk_IDirect3DTextureImpl_1_AddRef(IDirect3DTexture *iface)
static ULONG WINAPI
Thunk_IDirect3DTextureImpl_2_Release(IDirect3DTexture2 *iface)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface);
IDirectDrawSurfaceImpl *This = surface_from_texture2(iface);
TRACE("(%p)->() thunking to IDirectDrawSurface7 interface.\n", This);
return IDirectDrawSurface7_Release((IDirectDrawSurface7 *)This);
......@@ -100,7 +110,7 @@ Thunk_IDirect3DTextureImpl_2_Release(IDirect3DTexture2 *iface)
static ULONG WINAPI
Thunk_IDirect3DTextureImpl_1_Release(IDirect3DTexture *iface)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture, iface);
IDirectDrawSurfaceImpl *This = surface_from_texture1(iface);
TRACE("(%p)->() thunking to IDirectDrawSurface7 interface.\n", This);
return IDirectDrawSurface7_Release(COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirect3DTexture, IDirectDrawSurface7, iface));
......@@ -127,7 +137,7 @@ IDirect3DTextureImpl_1_Initialize(IDirect3DTexture *iface,
IDirect3DDevice *Direct3DDevice,
IDirectDrawSurface *DDSurface)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture, iface);
IDirectDrawSurfaceImpl *This = surface_from_texture1(iface);
IDirect3DDeviceImpl *d3d = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice, Direct3DDevice);
IDirectDrawSurfaceImpl *surf = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface3, DDSurface);
TRACE("(%p)->(%p,%p) Not implemented\n", This, d3d, surf);
......@@ -152,7 +162,7 @@ IDirect3DTextureImpl_PaletteChanged(IDirect3DTexture2 *iface,
DWORD Start,
DWORD Count)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface);
IDirectDrawSurfaceImpl *This = surface_from_texture2(iface);
FIXME("(%p)->(%08x,%08x): stub!\n", This, Start, Count);
return D3D_OK;
}
......@@ -162,7 +172,7 @@ Thunk_IDirect3DTextureImpl_1_PaletteChanged(IDirect3DTexture *iface,
DWORD Start,
DWORD Count)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture, iface);
IDirectDrawSurfaceImpl *This = surface_from_texture1(iface);
TRACE("(%p)->(%08x,%08x) thunking to IDirect3DTexture2 interface.\n", This, Start, Count);
return IDirect3DTexture2_PaletteChanged(COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirect3DTexture, IDirect3DTexture2, iface),
......@@ -184,7 +194,7 @@ Thunk_IDirect3DTextureImpl_1_PaletteChanged(IDirect3DTexture *iface,
static HRESULT WINAPI
IDirect3DTextureImpl_1_Unload(IDirect3DTexture *iface)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture, iface);
IDirectDrawSurfaceImpl *This = surface_from_texture1(iface);
TRACE("(%p)->(): not implemented!\n", This);
return DDERR_UNSUPPORTED;
}
......@@ -208,7 +218,7 @@ IDirect3DTextureImpl_GetHandle(IDirect3DTexture2 *iface,
IDirect3DDevice2 *Direct3DDevice2,
D3DTEXTUREHANDLE *lpHandle)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface);
IDirectDrawSurfaceImpl *This = surface_from_texture2(iface);
IDirect3DDeviceImpl *d3d = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice2, Direct3DDevice2);
TRACE("(%p)->(%p,%p)\n", This, d3d, lpHandle);
......@@ -236,7 +246,7 @@ Thunk_IDirect3DTextureImpl_1_GetHandle(IDirect3DTexture *iface,
LPDIRECT3DDEVICE lpDirect3DDevice,
LPD3DTEXTUREHANDLE lpHandle)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture, iface);
IDirectDrawSurfaceImpl *This = surface_from_texture1(iface);
IDirect3DDeviceImpl *d3d = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice, lpDirect3DDevice);
IDirect3DTexture2 *d3d_texture2 = (IDirect3DTexture2 *)&This->IDirect3DTexture2_vtbl;
IDirect3DDevice2 *d3d_device2 = (IDirect3DDevice2 *)&d3d->IDirect3DDevice2_vtbl;
......@@ -294,7 +304,7 @@ static HRESULT WINAPI
IDirect3DTextureImpl_Load(IDirect3DTexture2 *iface,
IDirect3DTexture2 *D3DTexture2)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface);
IDirectDrawSurfaceImpl *This = surface_from_texture2(iface);
IDirectDrawSurfaceImpl *src_ptr = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirect3DTexture2, D3DTexture2);
HRESULT ret_value = D3D_OK;
if(src_ptr == This)
......@@ -468,7 +478,7 @@ static HRESULT WINAPI
Thunk_IDirect3DTextureImpl_1_Load(IDirect3DTexture *iface,
IDirect3DTexture *D3DTexture)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture, iface);
IDirectDrawSurfaceImpl *This = surface_from_texture1(iface);
IDirectDrawSurfaceImpl *Texture = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirect3DTexture, D3DTexture);
TRACE("(%p)->(%p) thunking to IDirect3DTexture2 interface.\n", This, Texture);
......
......@@ -44,6 +44,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d7);
WINE_DECLARE_DEBUG_CHANNEL(ddraw_thunk);
static inline IDirect3DVertexBufferImpl *vb_from_vb1(IDirect3DVertexBuffer *iface)
{
return (IDirect3DVertexBufferImpl *)((char*)iface
- FIELD_OFFSET(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer_vtbl));
}
/*****************************************************************************
* IUnknown Methods
......@@ -69,7 +74,7 @@ IDirect3DVertexBufferImpl_QueryInterface(IDirect3DVertexBuffer7 *iface,
REFIID riid,
void **obj)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface;
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), obj);
/* By default, set the object pointer to NULL */
......@@ -105,7 +110,7 @@ Thunk_IDirect3DVertexBufferImpl_1_QueryInterface(IDirect3DVertexBuffer *iface,
REFIID riid,
void **obj)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
IDirect3DVertexBufferImpl *This = vb_from_vb1(iface);
TRACE_(ddraw_thunk)("(%p)->(%s,%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, debugstr_guid(riid), obj);
return IDirect3DVertexBuffer7_QueryInterface((IDirect3DVertexBuffer7 *)This, riid, obj);
......@@ -123,7 +128,7 @@ Thunk_IDirect3DVertexBufferImpl_1_QueryInterface(IDirect3DVertexBuffer *iface,
static ULONG WINAPI
IDirect3DVertexBufferImpl_AddRef(IDirect3DVertexBuffer7 *iface)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p/%p)->() incrementing from %u.\n", This, iface, ref - 1);
......@@ -134,7 +139,7 @@ IDirect3DVertexBufferImpl_AddRef(IDirect3DVertexBuffer7 *iface)
static ULONG WINAPI
Thunk_IDirect3DVertexBufferImpl_1_AddRef(IDirect3DVertexBuffer *iface)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
IDirect3DVertexBufferImpl *This = vb_from_vb1(iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", This);
return IDirect3DVertexBuffer7_AddRef((IDirect3DVertexBuffer7 *)This);
......@@ -153,7 +158,7 @@ Thunk_IDirect3DVertexBufferImpl_1_AddRef(IDirect3DVertexBuffer *iface)
static ULONG WINAPI
IDirect3DVertexBufferImpl_Release(IDirect3DVertexBuffer7 *iface)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->() decrementing from %u.\n", This, ref + 1);
......@@ -199,7 +204,7 @@ IDirect3DVertexBufferImpl_Release(IDirect3DVertexBuffer7 *iface)
static ULONG WINAPI
Thunk_IDirect3DVertexBufferImpl_1_Release(IDirect3DVertexBuffer *iface)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
IDirect3DVertexBufferImpl *This = vb_from_vb1(iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", This);
return IDirect3DVertexBuffer7_Release((IDirect3DVertexBuffer7 *)This);
......@@ -234,7 +239,7 @@ IDirect3DVertexBufferImpl_Lock(IDirect3DVertexBuffer7 *iface,
void **Data,
DWORD *Size)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface;
WINED3DVERTEXBUFFER_DESC Desc;
HRESULT hr;
TRACE("(%p)->(%08x,%p,%p)\n", This, Flags, Data, Size);
......@@ -269,7 +274,7 @@ Thunk_IDirect3DVertexBufferImpl_1_Lock(IDirect3DVertexBuffer *iface,
void **Data,
DWORD *Size)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
IDirect3DVertexBufferImpl *This = vb_from_vb1(iface);
TRACE_(ddraw_thunk)("(%p)->(%08x,%p,%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, Flags, Data, Size);
return IDirect3DVertexBuffer7_Lock((IDirect3DVertexBuffer7 *)This, Flags, Data, Size);
......@@ -287,7 +292,7 @@ Thunk_IDirect3DVertexBufferImpl_1_Lock(IDirect3DVertexBuffer *iface,
static HRESULT WINAPI
IDirect3DVertexBufferImpl_Unlock(IDirect3DVertexBuffer7 *iface)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface;
HRESULT hr;
TRACE("(%p)->()\n", This);
......@@ -301,7 +306,7 @@ IDirect3DVertexBufferImpl_Unlock(IDirect3DVertexBuffer7 *iface)
static HRESULT WINAPI
Thunk_IDirect3DVertexBufferImpl_1_Unlock(IDirect3DVertexBuffer *iface)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
IDirect3DVertexBufferImpl *This = vb_from_vb1(iface);
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", This);
return IDirect3DVertexBuffer7_Unlock((IDirect3DVertexBuffer7 *)This);
......@@ -340,7 +345,7 @@ IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexBuffer7 *iface,
IDirect3DDevice7 *D3DDevice,
DWORD Flags)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface;
IDirect3DVertexBufferImpl *Src = ICOM_OBJECT(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, SrcBuffer);
IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice7, D3DDevice);
BOOL oldClip, doClip;
......@@ -413,7 +418,7 @@ Thunk_IDirect3DVertexBufferImpl_1_ProcessVertices(IDirect3DVertexBuffer *iface,
IDirect3DDevice3 *D3DDevice,
DWORD Flags)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
IDirect3DVertexBufferImpl *This = vb_from_vb1(iface);
IDirect3DVertexBufferImpl *Src = ICOM_OBJECT(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, SrcBuffer);
IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice3, D3DDevice);
......@@ -440,7 +445,7 @@ static HRESULT WINAPI
IDirect3DVertexBufferImpl_GetVertexBufferDesc(IDirect3DVertexBuffer7 *iface,
D3DVERTEXBUFFERDESC *Desc)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface;
WINED3DVERTEXBUFFER_DESC WDesc;
HRESULT hr;
TRACE("(%p)->(%p)\n", This, Desc);
......@@ -470,7 +475,7 @@ static HRESULT WINAPI
Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc(IDirect3DVertexBuffer *iface,
D3DVERTEXBUFFERDESC *Desc)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
IDirect3DVertexBufferImpl *This = vb_from_vb1(iface);
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, Desc);
return IDirect3DVertexBuffer7_GetVertexBufferDesc((IDirect3DVertexBuffer7 *)This, Desc);
......@@ -495,7 +500,7 @@ IDirect3DVertexBufferImpl_Optimize(IDirect3DVertexBuffer7 *iface,
IDirect3DDevice7 *D3DDevice,
DWORD Flags)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface;
IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice7, D3DDevice);
static BOOL hide = FALSE;
......@@ -520,7 +525,7 @@ Thunk_IDirect3DVertexBufferImpl_1_Optimize(IDirect3DVertexBuffer *iface,
IDirect3DDevice3 *D3DDevice,
DWORD Flags)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
IDirect3DVertexBufferImpl *This = vb_from_vb1(iface);
IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice3, D3DDevice);
TRACE_(ddraw_thunk)("(%p)->(%p,%08x) thunking to IDirect3DVertexBuffer7 interface.\n", This, D3D, Flags);
......@@ -559,7 +564,7 @@ IDirect3DVertexBufferImpl_ProcessVerticesStrided(IDirect3DVertexBuffer7 *iface,
IDirect3DDevice7 *D3DDevice,
DWORD Flags)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface;
IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice7, D3DDevice);
FIXME("(%p)->(%08x,%08x,%08x,%p,%08x,%p,%08x): stub!\n", This, VertexOp, DestIndex, Count, StrideData, VertexTypeDesc, D3D, Flags);
return DD_OK;
......
......@@ -177,7 +177,7 @@ IDirect3DViewportImpl_QueryInterface(IDirect3DViewport3 *iface,
static ULONG WINAPI
IDirect3DViewportImpl_AddRef(IDirect3DViewport3 *iface)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->() incrementing from %u.\n", This, ref - 1);
......@@ -197,7 +197,7 @@ IDirect3DViewportImpl_AddRef(IDirect3DViewport3 *iface)
static ULONG WINAPI
IDirect3DViewportImpl_Release(IDirect3DViewport3 *iface)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->() decrementing from %u.\n", This, ref + 1);
......@@ -250,7 +250,7 @@ static HRESULT WINAPI
IDirect3DViewportImpl_GetViewport(IDirect3DViewport3 *iface,
D3DVIEWPORT *lpData)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
DWORD dwSize;
TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
......@@ -290,7 +290,7 @@ static HRESULT WINAPI
IDirect3DViewportImpl_SetViewport(IDirect3DViewport3 *iface,
D3DVIEWPORT *lpData)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
LPDIRECT3DVIEWPORT3 current_viewport;
TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
......@@ -358,7 +358,7 @@ IDirect3DViewportImpl_TransformVertices(IDirect3DViewport3 *iface,
DWORD dwFlags,
DWORD *lpOffScreen)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
D3DMATRIX view_mat, world_mat, proj_mat, mat;
float *in;
float *out;
......@@ -497,7 +497,7 @@ IDirect3DViewportImpl_LightElements(IDirect3DViewport3 *iface,
DWORD dwElementCount,
LPD3DLIGHTDATA lpData)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
TRACE("(%p)->(%08x,%p): Unimplemented!\n", This, dwElementCount, lpData);
return DDERR_UNSUPPORTED;
}
......@@ -518,7 +518,7 @@ static HRESULT WINAPI
IDirect3DViewportImpl_SetBackground(IDirect3DViewport3 *iface,
D3DMATERIALHANDLE hMat)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
TRACE("(%p)->(%d)\n", This, hMat);
EnterCriticalSection(&ddraw_cs);
......@@ -572,7 +572,7 @@ IDirect3DViewportImpl_GetBackground(IDirect3DViewport3 *iface,
D3DMATERIALHANDLE *lphMat,
BOOL *lpValid)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
TRACE("(%p)->(%p,%p)\n", This, lphMat, lpValid);
EnterCriticalSection(&ddraw_cs);
......@@ -612,7 +612,7 @@ static HRESULT WINAPI
IDirect3DViewportImpl_SetBackgroundDepth(IDirect3DViewport3 *iface,
IDirectDrawSurface *lpDDSurface)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
FIXME("(%p)->(%p): stub!\n", This, lpDDSurface);
return D3D_OK;
}
......@@ -636,7 +636,7 @@ IDirect3DViewportImpl_GetBackgroundDepth(IDirect3DViewport3 *iface,
IDirectDrawSurface **lplpDDSurface,
LPBOOL lpValid)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
FIXME("(%p)->(%p,%p): stub!\n", This, lplpDDSurface, lpValid);
return DD_OK;
}
......@@ -664,7 +664,7 @@ IDirect3DViewportImpl_Clear(IDirect3DViewport3 *iface,
D3DRECT *lpRects,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
DWORD color = 0x00000000;
HRESULT hr;
LPDIRECT3DVIEWPORT3 current_viewport;
......@@ -726,7 +726,7 @@ static HRESULT WINAPI
IDirect3DViewportImpl_AddLight(IDirect3DViewport3 *iface,
IDirect3DLight *lpDirect3DLight)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
IDirect3DLightImpl *lpDirect3DLightImpl = ICOM_OBJECT(IDirect3DLightImpl, IDirect3DLight, lpDirect3DLight);
DWORD i = 0;
DWORD map = This->map_lights;
......@@ -782,7 +782,7 @@ static HRESULT WINAPI
IDirect3DViewportImpl_DeleteLight(IDirect3DViewport3 *iface,
IDirect3DLight *lpDirect3DLight)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
IDirect3DLightImpl *lpDirect3DLightImpl = ICOM_OBJECT(IDirect3DLightImpl, IDirect3DLight, lpDirect3DLight);
IDirect3DLightImpl *cur_light, *prev_light = NULL;
......@@ -829,7 +829,7 @@ IDirect3DViewportImpl_NextLight(IDirect3DViewport3 *iface,
IDirect3DLight **lplpDirect3DLight,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
FIXME("(%p)->(%p,%p,%08x): stub!\n", This, lpDirect3DLight, lplpDirect3DLight, dwFlags);
return D3D_OK;
}
......@@ -858,7 +858,7 @@ static HRESULT WINAPI
IDirect3DViewportImpl_GetViewport2(IDirect3DViewport3 *iface,
D3DVIEWPORT2 *lpData)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
DWORD dwSize;
TRACE("(%p)->(%p)\n", This, lpData);
......@@ -897,7 +897,7 @@ static HRESULT WINAPI
IDirect3DViewportImpl_SetViewport2(IDirect3DViewport3 *iface,
D3DVIEWPORT2 *lpData)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
LPDIRECT3DVIEWPORT3 current_viewport;
TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
......@@ -945,7 +945,7 @@ static HRESULT WINAPI
IDirect3DViewportImpl_SetBackgroundDepth2(IDirect3DViewport3 *iface,
IDirectDrawSurface4 *lpDDS)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
FIXME("(%p)->(%p): stub!\n", This, lpDDS);
return D3D_OK;
}
......@@ -968,7 +968,7 @@ IDirect3DViewportImpl_GetBackgroundDepth2(IDirect3DViewport3 *iface,
IDirectDrawSurface4 **lplpDDS,
BOOL *lpValid)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpDDS, lpValid);
return D3D_OK;
}
......@@ -998,7 +998,7 @@ IDirect3DViewportImpl_Clear2(IDirect3DViewport3 *iface,
D3DVALUE dvZ,
DWORD dwStencil)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
HRESULT hr;
LPDIRECT3DVIEWPORT3 current_viewport;
IDirect3DDevice3 *d3d_device3;
......
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