ddraw: Get rid of IDirect3DLightImpl.

This commit is contained in:
Henri Verbeet 2012-03-13 20:31:37 +01:00 committed by Alexandre Julliard
parent 2071026acd
commit 7b918934e6
4 changed files with 52 additions and 52 deletions

View File

@ -4123,7 +4123,7 @@ static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light
IUnknown *outer_unknown)
{
struct ddraw *ddraw = impl_from_IDirect3D3(iface);
IDirect3DLightImpl *object;
struct d3d_light *object;
TRACE("iface %p, light %p, outer_unknown %p.\n", iface, light, outer_unknown);

View File

@ -42,7 +42,6 @@ extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HI
/* Typdef the interfaces */
typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl;
typedef struct IDirect3DLightImpl IDirect3DLightImpl;
typedef struct IDirect3DViewportImpl IDirect3DViewportImpl;
typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl;
typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
@ -402,7 +401,7 @@ struct object_creation_info
/******************************************************************************
* IDirect3DLight implementation structure - Wraps to D3D7
******************************************************************************/
struct IDirect3DLightImpl
struct d3d_light
{
IDirect3DLight IDirect3DLight_iface;
LONG ref;
@ -422,10 +421,10 @@ struct IDirect3DLightImpl
};
/* Helper functions */
void light_activate(IDirect3DLightImpl *light) DECLSPEC_HIDDEN;
void light_deactivate(IDirect3DLightImpl *light) DECLSPEC_HIDDEN;
void d3d_light_init(IDirect3DLightImpl *light, struct ddraw *ddraw) DECLSPEC_HIDDEN;
IDirect3DLightImpl *unsafe_impl_from_IDirect3DLight(IDirect3DLight *iface) DECLSPEC_HIDDEN;
void light_activate(struct d3d_light *light) DECLSPEC_HIDDEN;
void light_deactivate(struct d3d_light *light) DECLSPEC_HIDDEN;
void d3d_light_init(struct d3d_light *light, struct ddraw *ddraw) DECLSPEC_HIDDEN;
struct d3d_light *unsafe_impl_from_IDirect3DLight(IDirect3DLight *iface) DECLSPEC_HIDDEN;
/******************************************************************************
* IDirect3DMaterial implementation structure - Wraps to D3D7

View File

@ -32,7 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
* Updates the Direct3DDevice7 lighting parameters
*
*****************************************************************************/
static void light_update(IDirect3DLightImpl *light)
static void light_update(struct d3d_light *light)
{
IDirect3DDeviceImpl *device;
@ -50,7 +50,7 @@ static void light_update(IDirect3DLightImpl *light)
* Uses the Direct3DDevice7::LightEnable method to active the light
*
*****************************************************************************/
void light_activate(IDirect3DLightImpl *light)
void light_activate(struct d3d_light *light)
{
IDirect3DDeviceImpl *device;
@ -74,7 +74,7 @@ void light_activate(IDirect3DLightImpl *light)
* Uses the Direct3DDevice7::LightEnable method to deactivate the light
*
*****************************************************************************/
void light_deactivate(IDirect3DLightImpl *light)
void light_deactivate(struct d3d_light *light)
{
IDirect3DDeviceImpl *device;
@ -91,9 +91,9 @@ void light_deactivate(IDirect3DLightImpl *light)
}
}
static inline IDirect3DLightImpl *impl_from_IDirect3DLight(IDirect3DLight *iface)
static inline struct d3d_light *impl_from_IDirect3DLight(IDirect3DLight *iface)
{
return CONTAINING_RECORD(iface, IDirect3DLightImpl, IDirect3DLight_iface);
return CONTAINING_RECORD(iface, struct d3d_light, IDirect3DLight_iface);
}
/*****************************************************************************
@ -109,7 +109,7 @@ static inline IDirect3DLightImpl *impl_from_IDirect3DLight(IDirect3DLight *iface
* Returns:
* E_NOINTERFACE, because it's a stub
*****************************************************************************/
static HRESULT WINAPI IDirect3DLightImpl_QueryInterface(IDirect3DLight *iface, REFIID riid, void **object)
static HRESULT WINAPI d3d_light_QueryInterface(IDirect3DLight *iface, REFIID riid, void **object)
{
FIXME("iface %p, riid %s, object %p stub!\n", iface, debugstr_guid(riid), object);
@ -117,25 +117,26 @@ static HRESULT WINAPI IDirect3DLightImpl_QueryInterface(IDirect3DLight *iface, R
return E_NOINTERFACE;
}
static ULONG WINAPI IDirect3DLightImpl_AddRef(IDirect3DLight *iface)
static ULONG WINAPI d3d_light_AddRef(IDirect3DLight *iface)
{
IDirect3DLightImpl *This = impl_from_IDirect3DLight(iface);
ULONG ref = InterlockedIncrement(&This->ref);
struct d3d_light *light = impl_from_IDirect3DLight(iface);
ULONG ref = InterlockedIncrement(&light->ref);
TRACE("%p increasing refcount to %u.\n", This, ref);
TRACE("%p increasing refcount to %u.\n", light, ref);
return ref;
}
static ULONG WINAPI IDirect3DLightImpl_Release(IDirect3DLight *iface)
static ULONG WINAPI d3d_light_Release(IDirect3DLight *iface)
{
IDirect3DLightImpl *This = impl_from_IDirect3DLight(iface);
ULONG ref = InterlockedDecrement(&This->ref);
struct d3d_light *light = impl_from_IDirect3DLight(iface);
ULONG ref = InterlockedDecrement(&light->ref);
TRACE("%p decreasing refcount to %u.\n", This, ref);
TRACE("%p decreasing refcount to %u.\n", light, ref);
if (!ref) {
HeapFree(GetProcessHeap(), 0, This);
if (!ref)
{
HeapFree(GetProcessHeap(), 0, light);
return 0;
}
return ref;
@ -158,7 +159,7 @@ static ULONG WINAPI IDirect3DLightImpl_Release(IDirect3DLight *iface)
* D3D_OK
*
*****************************************************************************/
static HRESULT WINAPI IDirect3DLightImpl_Initialize(IDirect3DLight *iface, IDirect3D *d3d)
static HRESULT WINAPI d3d_light_Initialize(IDirect3DLight *iface, IDirect3D *d3d)
{
TRACE("iface %p, d3d %p.\n", iface, d3d);
@ -187,10 +188,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 d3d_light_SetLight(IDirect3DLight *iface, D3DLIGHT *lpLight)
{
IDirect3DLightImpl *This = impl_from_IDirect3DLight(iface);
LPD3DLIGHT7 light7 = &This->light7;
struct d3d_light *light = impl_from_IDirect3DLight(iface);
D3DLIGHT7 *light7 = &light->light7;
TRACE("iface %p, light %p.\n", iface, lpLight);
@ -225,9 +226,9 @@ static HRESULT WINAPI IDirect3DLightImpl_SetLight(IDirect3DLight *iface, D3DLIGH
light7->dvPhi = lpLight->dvPhi;
wined3d_mutex_lock();
memcpy(&This->light, lpLight, lpLight->dwSize);
if (This->light.dwFlags & D3DLIGHT_ACTIVE)
light_update(This);
memcpy(&light->light, lpLight, lpLight->dwSize);
if (light->light.dwFlags & D3DLIGHT_ACTIVE)
light_update(light);
wined3d_mutex_unlock();
return D3D_OK;
@ -245,20 +246,20 @@ static HRESULT WINAPI IDirect3DLightImpl_SetLight(IDirect3DLight *iface, D3DLIGH
* D3D_OK on success
* DDERR_INVALIDPARAMS if Light is NULL
*****************************************************************************/
static HRESULT WINAPI IDirect3DLightImpl_GetLight(IDirect3DLight *iface, D3DLIGHT *lpLight)
static HRESULT WINAPI d3d_light_GetLight(IDirect3DLight *iface, D3DLIGHT *lpLight)
{
IDirect3DLightImpl *This = impl_from_IDirect3DLight(iface);
struct d3d_light *light = impl_from_IDirect3DLight(iface);
TRACE("iface %p, light %p.\n", iface, lpLight);
if (TRACE_ON(ddraw))
{
TRACE(" Returning light definition :\n");
dump_light(&This->light);
dump_light(&light->light);
}
wined3d_mutex_lock();
memcpy(lpLight, &This->light, lpLight->dwSize);
memcpy(lpLight, &light->light, lpLight->dwSize);
wined3d_mutex_unlock();
return DD_OK;
@ -267,23 +268,23 @@ static HRESULT WINAPI IDirect3DLightImpl_GetLight(IDirect3DLight *iface, D3DLIGH
static const struct IDirect3DLightVtbl d3d_light_vtbl =
{
/*** IUnknown Methods ***/
IDirect3DLightImpl_QueryInterface,
IDirect3DLightImpl_AddRef,
IDirect3DLightImpl_Release,
d3d_light_QueryInterface,
d3d_light_AddRef,
d3d_light_Release,
/*** IDirect3DLight Methods ***/
IDirect3DLightImpl_Initialize,
IDirect3DLightImpl_SetLight,
IDirect3DLightImpl_GetLight
d3d_light_Initialize,
d3d_light_SetLight,
d3d_light_GetLight
};
void d3d_light_init(IDirect3DLightImpl *light, struct ddraw *ddraw)
void d3d_light_init(struct d3d_light *light, struct ddraw *ddraw)
{
light->IDirect3DLight_iface.lpVtbl = &d3d_light_vtbl;
light->ref = 1;
light->ddraw = ddraw;
}
IDirect3DLightImpl *unsafe_impl_from_IDirect3DLight(IDirect3DLight *iface)
struct d3d_light *unsafe_impl_from_IDirect3DLight(IDirect3DLight *iface)
{
if (!iface)
return NULL;

View File

@ -63,10 +63,10 @@ void viewport_activate(IDirect3DViewportImpl *This, BOOL ignore_lights)
if (!ignore_lights)
{
IDirect3DLightImpl *light;
struct d3d_light *light;
/* Activate all the lights associated with this context */
LIST_FOR_EACH_ENTRY(light, &This->light_list, IDirect3DLightImpl, entry)
LIST_FOR_EACH_ENTRY(light, &This->light_list, struct d3d_light, entry)
{
light_activate(light);
}
@ -764,7 +764,7 @@ static HRESULT WINAPI IDirect3DViewportImpl_AddLight(IDirect3DViewport3 *iface,
IDirect3DLight *lpDirect3DLight)
{
IDirect3DViewportImpl *This = impl_from_IDirect3DViewport3(iface);
IDirect3DLightImpl *lpDirect3DLightImpl = unsafe_impl_from_IDirect3DLight(lpDirect3DLight);
struct d3d_light *light_impl = unsafe_impl_from_IDirect3DLight(lpDirect3DLight);
DWORD i = 0;
DWORD map = This->map_lights;
@ -784,20 +784,20 @@ static HRESULT WINAPI IDirect3DViewportImpl_AddLight(IDirect3DViewport3 *iface,
map >>= 1;
++i;
}
lpDirect3DLightImpl->dwLightIndex = i;
light_impl->dwLightIndex = i;
This->num_lights++;
This->map_lights |= 1<<i;
/* Add the light in the 'linked' chain */
list_add_head(&This->light_list, &lpDirect3DLightImpl->entry);
list_add_head(&This->light_list, &light_impl->entry);
IDirect3DLight_AddRef(lpDirect3DLight);
/* Attach the light to the viewport */
lpDirect3DLightImpl->active_viewport = This;
light_impl->active_viewport = This;
/* If active, activate the light */
if (This->active_device)
light_activate(lpDirect3DLightImpl);
light_activate(light_impl);
wined3d_mutex_unlock();
@ -821,7 +821,7 @@ static HRESULT WINAPI IDirect3DViewportImpl_DeleteLight(IDirect3DViewport3 *ifac
IDirect3DLight *lpDirect3DLight)
{
IDirect3DViewportImpl *This = impl_from_IDirect3DViewport3(iface);
IDirect3DLightImpl *l = unsafe_impl_from_IDirect3DLight(lpDirect3DLight);
struct d3d_light *l = unsafe_impl_from_IDirect3DLight(lpDirect3DLight);
TRACE("iface %p, light %p.\n", iface, lpDirect3DLight);
@ -863,7 +863,7 @@ static HRESULT WINAPI IDirect3DViewportImpl_NextLight(IDirect3DViewport3 *iface,
IDirect3DLight *lpDirect3DLight, IDirect3DLight **lplpDirect3DLight, DWORD dwFlags)
{
IDirect3DViewportImpl *This = impl_from_IDirect3DViewport3(iface);
IDirect3DLightImpl *l = unsafe_impl_from_IDirect3DLight(lpDirect3DLight);
struct d3d_light *l = unsafe_impl_from_IDirect3DLight(lpDirect3DLight);
struct list *entry;
HRESULT hr;
@ -904,7 +904,7 @@ static HRESULT WINAPI IDirect3DViewportImpl_NextLight(IDirect3DViewport3 *iface,
if (entry)
{
*lplpDirect3DLight = (IDirect3DLight *)LIST_ENTRY(entry, IDirect3DLightImpl, entry);
*lplpDirect3DLight = (IDirect3DLight *)LIST_ENTRY(entry, struct d3d_light, entry);
IDirect3DLight_AddRef(*lplpDirect3DLight);
hr = D3D_OK;
}