Module: wine Branch: master Commit: 05194507080646a65642f78f6c141263b8919860 URL: http://source.winehq.org/git/wine.git/?a=commit;h=05194507080646a65642f78f6c...
Author: Michael Stefaniuc mstefani@redhat.de Date: Thu Jun 9 11:53:52 2011 +0200
ddraw: COM cleanup for the IDirect3DLight iface.
---
dlls/ddraw/ddraw.c | 2 +- dlls/ddraw/ddraw_private.h | 2 +- dlls/ddraw/light.c | 52 +++++++++++-------------------------------- 3 files changed, 16 insertions(+), 40 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 3a8dba1..df74def 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -4550,7 +4550,7 @@ static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light d3d_light_init(object, This);
TRACE("Created light %p.\n", object); - *light = (IDirect3DLight *)object; + *light = &object->IDirect3DLight_iface;
return D3D_OK; } diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index fd1017d..c749168 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -387,7 +387,7 @@ struct object_creation_info ******************************************************************************/ struct IDirect3DLightImpl { - const IDirect3DLightVtbl *lpVtbl; + IDirect3DLight IDirect3DLight_iface; LONG ref;
/* IDirect3DLight fields */ diff --git a/dlls/ddraw/light.c b/dlls/ddraw/light.c index a6a3cad..f7b8347 100644 --- a/dlls/ddraw/light.c +++ b/dlls/ddraw/light.c @@ -91,9 +91,10 @@ void light_deactivate(IDirect3DLightImpl *light) } }
-/***************************************************************************** - * IUnknown Methods. - *****************************************************************************/ +static inline IDirect3DLightImpl *impl_from_IDirect3DLight(IDirect3DLight *iface) +{ + return CONTAINING_RECORD(iface, IDirect3DLightImpl, IDirect3DLight_iface); +}
/***************************************************************************** * IDirect3DLight::QueryInterface @@ -116,19 +117,9 @@ static HRESULT WINAPI IDirect3DLightImpl_QueryInterface(IDirect3DLight *iface, R return E_NOINTERFACE; }
-/***************************************************************************** - * IDirect3DLight::AddRef - * - * Increases the refcount by 1 - * - * Returns: - * The new refcount - * - *****************************************************************************/ -static ULONG WINAPI -IDirect3DLightImpl_AddRef(IDirect3DLight *iface) +static ULONG WINAPI IDirect3DLightImpl_AddRef(IDirect3DLight *iface) { - IDirect3DLightImpl *This = (IDirect3DLightImpl *)iface; + IDirect3DLightImpl *This = impl_from_IDirect3DLight(iface); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("%p increasing refcount to %u.\n", This, ref); @@ -136,20 +127,9 @@ IDirect3DLightImpl_AddRef(IDirect3DLight *iface) return ref; }
-/***************************************************************************** - * IDirect3DLight::Release - * - * Reduces the refcount by one. If the refcount falls to 0, the object - * is destroyed - * - * Returns: - * The new refcount - * - *****************************************************************************/ -static ULONG WINAPI -IDirect3DLightImpl_Release(IDirect3DLight *iface) +static ULONG WINAPI IDirect3DLightImpl_Release(IDirect3DLight *iface) { - IDirect3DLightImpl *This = (IDirect3DLightImpl *)iface; + IDirect3DLightImpl *This = impl_from_IDirect3DLight(iface); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("%p decreasing refcount to %u.\n", This, ref); @@ -207,12 +187,10 @@ static const float zero_value[] = { 0.0, 0.0, 0.0, 0.0 };
-static HRESULT WINAPI -IDirect3DLightImpl_SetLight(IDirect3DLight *iface, - D3DLIGHT *lpLight) +static HRESULT WINAPI IDirect3DLightImpl_SetLight(IDirect3DLight *iface, D3DLIGHT *lpLight) { - IDirect3DLightImpl *This = (IDirect3DLightImpl *)iface; - LPD3DLIGHT7 light7 = &(This->light7); + IDirect3DLightImpl *This = impl_from_IDirect3DLight(iface); + LPD3DLIGHT7 light7 = &This->light7;
TRACE("iface %p, light %p.\n", iface, lpLight);
@@ -266,11 +244,9 @@ IDirect3DLightImpl_SetLight(IDirect3DLight *iface, * D3D_OK on success * DDERR_INVALIDPARAMS if Light is NULL *****************************************************************************/ -static HRESULT WINAPI -IDirect3DLightImpl_GetLight(IDirect3DLight *iface, - D3DLIGHT *lpLight) +static HRESULT WINAPI IDirect3DLightImpl_GetLight(IDirect3DLight *iface, D3DLIGHT *lpLight) { - IDirect3DLightImpl *This = (IDirect3DLightImpl *)iface; + IDirect3DLightImpl *This = impl_from_IDirect3DLight(iface);
TRACE("iface %p, light %p.\n", iface, lpLight);
@@ -301,7 +277,7 @@ static const struct IDirect3DLightVtbl d3d_light_vtbl =
void d3d_light_init(IDirect3DLightImpl *light, IDirectDrawImpl *ddraw) { - light->lpVtbl = &d3d_light_vtbl; + light->IDirect3DLight_iface.lpVtbl = &d3d_light_vtbl; light->ref = 1; light->ddraw = ddraw; }