ddraw: COM cleanup for the IDirect3DLight iface.

This commit is contained in:
Michael Stefaniuc 2011-06-09 11:53:52 +02:00 committed by Alexandre Julliard
parent 90154979a0
commit 0519450708
3 changed files with 16 additions and 40 deletions

View File

@ -4550,7 +4550,7 @@ static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light
d3d_light_init(object, This); d3d_light_init(object, This);
TRACE("Created light %p.\n", object); TRACE("Created light %p.\n", object);
*light = (IDirect3DLight *)object; *light = &object->IDirect3DLight_iface;
return D3D_OK; return D3D_OK;
} }

View File

@ -387,7 +387,7 @@ struct object_creation_info
******************************************************************************/ ******************************************************************************/
struct IDirect3DLightImpl struct IDirect3DLightImpl
{ {
const IDirect3DLightVtbl *lpVtbl; IDirect3DLight IDirect3DLight_iface;
LONG ref; LONG ref;
/* IDirect3DLight fields */ /* IDirect3DLight fields */

View File

@ -91,9 +91,10 @@ void light_deactivate(IDirect3DLightImpl *light)
} }
} }
/***************************************************************************** static inline IDirect3DLightImpl *impl_from_IDirect3DLight(IDirect3DLight *iface)
* IUnknown Methods. {
*****************************************************************************/ return CONTAINING_RECORD(iface, IDirect3DLightImpl, IDirect3DLight_iface);
}
/***************************************************************************** /*****************************************************************************
* IDirect3DLight::QueryInterface * IDirect3DLight::QueryInterface
@ -116,19 +117,9 @@ static HRESULT WINAPI IDirect3DLightImpl_QueryInterface(IDirect3DLight *iface, R
return E_NOINTERFACE; return E_NOINTERFACE;
} }
/***************************************************************************** static ULONG WINAPI IDirect3DLightImpl_AddRef(IDirect3DLight *iface)
* IDirect3DLight::AddRef
*
* Increases the refcount by 1
*
* Returns:
* The new refcount
*
*****************************************************************************/
static ULONG WINAPI
IDirect3DLightImpl_AddRef(IDirect3DLight *iface)
{ {
IDirect3DLightImpl *This = (IDirect3DLightImpl *)iface; IDirect3DLightImpl *This = impl_from_IDirect3DLight(iface);
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("%p increasing refcount to %u.\n", This, ref); TRACE("%p increasing refcount to %u.\n", This, ref);
@ -136,20 +127,9 @@ IDirect3DLightImpl_AddRef(IDirect3DLight *iface)
return ref; return ref;
} }
/***************************************************************************** static ULONG WINAPI IDirect3DLightImpl_Release(IDirect3DLight *iface)
* 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)
{ {
IDirect3DLightImpl *This = (IDirect3DLightImpl *)iface; IDirect3DLightImpl *This = impl_from_IDirect3DLight(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("%p decreasing refcount to %u.\n", 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 0.0, 0.0, 0.0, 0.0
}; };
static HRESULT WINAPI static HRESULT WINAPI IDirect3DLightImpl_SetLight(IDirect3DLight *iface, D3DLIGHT *lpLight)
IDirect3DLightImpl_SetLight(IDirect3DLight *iface,
D3DLIGHT *lpLight)
{ {
IDirect3DLightImpl *This = (IDirect3DLightImpl *)iface; IDirect3DLightImpl *This = impl_from_IDirect3DLight(iface);
LPD3DLIGHT7 light7 = &(This->light7); LPD3DLIGHT7 light7 = &This->light7;
TRACE("iface %p, light %p.\n", iface, lpLight); TRACE("iface %p, light %p.\n", iface, lpLight);
@ -266,11 +244,9 @@ IDirect3DLightImpl_SetLight(IDirect3DLight *iface,
* D3D_OK on success * D3D_OK on success
* DDERR_INVALIDPARAMS if Light is NULL * DDERR_INVALIDPARAMS if Light is NULL
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI static HRESULT WINAPI IDirect3DLightImpl_GetLight(IDirect3DLight *iface, D3DLIGHT *lpLight)
IDirect3DLightImpl_GetLight(IDirect3DLight *iface,
D3DLIGHT *lpLight)
{ {
IDirect3DLightImpl *This = (IDirect3DLightImpl *)iface; IDirect3DLightImpl *This = impl_from_IDirect3DLight(iface);
TRACE("iface %p, light %p.\n", iface, lpLight); 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) void d3d_light_init(IDirect3DLightImpl *light, IDirectDrawImpl *ddraw)
{ {
light->lpVtbl = &d3d_light_vtbl; light->IDirect3DLight_iface.lpVtbl = &d3d_light_vtbl;
light->ref = 1; light->ref = 1;
light->ddraw = ddraw; light->ddraw = ddraw;
} }