Commit 86a2fcf6 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

d3drm: Move up the IDirect3DRM{Frame,Light,Visual}Array implementations to avoid…

d3drm: Move up the IDirect3DRM{Frame,Light,Visual}Array implementations to avoid forward declarations.
parent 51d5a48c
......@@ -78,10 +78,6 @@ typedef struct {
LPDIRECT3DRMLIGHT* lights;
} IDirect3DRMLightArrayImpl;
HRESULT Direct3DRMFrameArray_create(IDirect3DRMFrameArray** obj);
HRESULT Direct3DRMVisualArray_create(IDirect3DRMVisualArray** ret_iface);
HRESULT Direct3DRMLightArray_create(IDirect3DRMLightArray** ret_iface);
static inline IDirect3DRMFrameImpl *impl_from_IDirect3DRMFrame2(IDirect3DRMFrame2 *iface)
{
return CONTAINING_RECORD(iface, IDirect3DRMFrameImpl, IDirect3DRMFrame2_iface);
......@@ -101,24 +97,19 @@ static inline IDirect3DRMLightArrayImpl *impl_from_IDirect3DRMLightArray(IDirect
}
/*** IUnknown methods ***/
static HRESULT WINAPI IDirect3DRMFrame2Impl_QueryInterface(IDirect3DRMFrame2* iface,
REFIID riid, void** object)
static HRESULT WINAPI IDirect3DRMFrameArrayImpl_QueryInterface(IDirect3DRMFrameArray* iface,
REFIID riid, void** object)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
TRACE("(%p/%p)->(%s, %p)\n", iface, This, debugstr_guid(riid), object);
*object = NULL;
if(IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDirect3DRMFrame) ||
IsEqualGUID(riid, &IID_IDirect3DRMFrame2))
{
*object = &This->IDirect3DRMFrame2_iface;
}
else if(IsEqualGUID(riid, &IID_IDirect3DRMFrame3))
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDirect3DRMFrameArray))
{
*object = &This->IDirect3DRMFrame3_iface;
*object = &This->IDirect3DRMFrameArray_iface;
}
else
{
......@@ -126,380 +117,741 @@ static HRESULT WINAPI IDirect3DRMFrame2Impl_QueryInterface(IDirect3DRMFrame2* if
return E_NOINTERFACE;
}
IDirect3DRMFrame2_AddRef(iface);
IDirect3DRMFrameArray_AddRef(iface);
return S_OK;
}
static ULONG WINAPI IDirect3DRMFrame2Impl_AddRef(IDirect3DRMFrame2* iface)
static ULONG WINAPI IDirect3DRMFrameArrayImpl_AddRef(IDirect3DRMFrameArray* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(): new ref = %d\n", This, ref);
TRACE("(%p)->(): new ref = %u\n", This, ref);
return ref;
}
static ULONG WINAPI IDirect3DRMFrame2Impl_Release(IDirect3DRMFrame2* iface)
static ULONG WINAPI IDirect3DRMFrameArrayImpl_Release(IDirect3DRMFrameArray* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
ULONG ref = InterlockedDecrement(&This->ref);
ULONG i;
TRACE("(%p)->(): new ref = %d\n", This, ref);
TRACE("(%p)->(): new ref = %u\n", This, ref);
if (!ref)
{
for (i = 0; i < This->nb_children; i++)
IDirect3DRMFrame3_Release(This->children[i]);
HeapFree(GetProcessHeap(), 0, This->children);
for (i = 0; i < This->nb_visuals; i++)
IDirect3DRMVisual_Release(This->visuals[i]);
HeapFree(GetProcessHeap(), 0, This->visuals);
for (i = 0; i < This->nb_lights; i++)
IDirect3DRMLight_Release(This->lights[i]);
HeapFree(GetProcessHeap(), 0, This->lights);
for (i = 0; i < This->size; i++)
IDirect3DRMFrame_Release(This->frames[i]);
HeapFree(GetProcessHeap(), 0, This->frames);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/*** IDirect3DRMObject methods ***/
static HRESULT WINAPI IDirect3DRMFrame2Impl_Clone(IDirect3DRMFrame2* iface,
LPUNKNOWN unkwn, REFIID riid,
LPVOID* object)
/*** IDirect3DRMArray methods ***/
static DWORD WINAPI IDirect3DRMFrameArrayImpl_GetSize(IDirect3DRMFrameArray* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
FIXME("(%p/%p)->(%p, %s, %p): stub\n", iface, This, unkwn, debugstr_guid(riid), object);
TRACE("(%p)->() = %d\n", This, This->size);
return E_NOTIMPL;
return This->size;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddDestroyCallback(IDirect3DRMFrame2* iface,
D3DRMOBJECTCALLBACK cb,
LPVOID argument)
/*** IDirect3DRMFrameArray methods ***/
static HRESULT WINAPI IDirect3DRMFrameArrayImpl_GetElement(IDirect3DRMFrameArray* iface, DWORD index, LPDIRECT3DRMFRAME* frame)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
TRACE("(%p)->(%u, %p)\n", This, index, frame);
return E_NOTIMPL;
}
if (!frame)
return D3DRMERR_BADVALUE;
static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteDestroyCallback(IDirect3DRMFrame2* iface,
D3DRMOBJECTCALLBACK cb,
LPVOID argument)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
*frame = NULL;
FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
if (index >= This->size)
return D3DRMERR_BADVALUE;
return E_NOTIMPL;
IDirect3DRMFrame_AddRef(This->frames[index]);
*frame = This->frames[index];
return D3DRM_OK;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_SetAppData(IDirect3DRMFrame2* iface,
DWORD data)
static const struct IDirect3DRMFrameArrayVtbl Direct3DRMFrameArray_Vtbl =
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%u): stub\n", iface, This, data);
return E_NOTIMPL;
}
/*** IUnknown methods ***/
IDirect3DRMFrameArrayImpl_QueryInterface,
IDirect3DRMFrameArrayImpl_AddRef,
IDirect3DRMFrameArrayImpl_Release,
/*** IDirect3DRMArray methods ***/
IDirect3DRMFrameArrayImpl_GetSize,
/*** IDirect3DRMFrameArray methods ***/
IDirect3DRMFrameArrayImpl_GetElement
};
static DWORD WINAPI IDirect3DRMFrame2Impl_GetAppData(IDirect3DRMFrame2* iface)
HRESULT Direct3DRMFrameArray_create(IDirect3DRMFrameArray** obj)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMFrameArrayImpl* object;
FIXME("(%p/%p)->(): stub\n", iface, This);
TRACE("(%p)\n", obj);
return 0;
}
*obj = NULL;
static HRESULT WINAPI IDirect3DRMFrame2Impl_SetName(IDirect3DRMFrame2* iface, LPCSTR name)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMFrameArrayImpl));
if (!object)
{
ERR("Out of memory\n");
return E_OUTOFMEMORY;
}
FIXME("(%p/%p)->(%s): stub\n", iface, This, name);
object->IDirect3DRMFrameArray_iface.lpVtbl = &Direct3DRMFrameArray_Vtbl;
object->ref = 1;
return E_NOTIMPL;
*obj = &object->IDirect3DRMFrameArray_iface;
return S_OK;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetName(IDirect3DRMFrame2* iface,
LPDWORD size, LPSTR name)
/*** IUnknown methods ***/
static HRESULT WINAPI IDirect3DRMVisualArrayImpl_QueryInterface(IDirect3DRMVisualArray* iface,
REFIID riid, void** ret_iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface);
FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, size, name);
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDirect3DRMFrameArray))
{
*ret_iface = iface;
IDirect3DRMVisualArray_AddRef(iface);
return S_OK;
}
return E_NOTIMPL;
*ret_iface = NULL;
WARN("Interface %s not implemented\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetClassName(IDirect3DRMFrame2* iface,
LPDWORD size, LPSTR name)
static ULONG WINAPI IDirect3DRMVisualArrayImpl_AddRef(IDirect3DRMVisualArray* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
ULONG ref = InterlockedIncrement(&This->ref);
FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, size, name);
TRACE("(%p)->(): new ref = %u\n", iface, ref);
return E_NOTIMPL;
return ref;
}
/*** IDirect3DRMFrame methods ***/
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddChild(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAME child)
static ULONG WINAPI IDirect3DRMVisualArrayImpl_Release(IDirect3DRMVisualArray* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMFrameImpl *frame = unsafe_impl_from_IDirect3DRMFrame2((LPDIRECT3DRMFRAME2)child);
IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
ULONG ref = InterlockedDecrement(&This->ref);
ULONG i;
TRACE("(%p/%p)->(%p)\n", iface, This, child);
TRACE("(%p)->(): new ref = %u\n", iface, ref);
if (!frame)
return D3DRMERR_BADOBJECT;
if (!ref)
{
for (i = 0; i < This->size; i++)
IDirect3DRMVisual_Release(This->visuals[i]);
HeapFree(GetProcessHeap(), 0, This->visuals);
HeapFree(GetProcessHeap(), 0, This);
}
return IDirect3DRMFrame3_AddChild(&This->IDirect3DRMFrame3_iface, &frame->IDirect3DRMFrame3_iface);
return ref;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddLight(IDirect3DRMFrame2* iface,
LPDIRECT3DRMLIGHT light)
/*** IDirect3DRMArray methods ***/
static DWORD WINAPI IDirect3DRMVisualArrayImpl_GetSize(IDirect3DRMVisualArray* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
TRACE("(%p/%p)->(%p)\n", iface, This, light);
TRACE("(%p)->() = %d\n", iface, This->size);
return IDirect3DRMFrame3_AddLight(&This->IDirect3DRMFrame3_iface, light);
return This->size;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddMoveCallback(IDirect3DRMFrame2* iface,
D3DRMFRAMEMOVECALLBACK cb, VOID *arg)
/*** IDirect3DRMVisualArray methods ***/
static HRESULT WINAPI IDirect3DRMVisualArrayImpl_GetElement(IDirect3DRMVisualArray* iface, DWORD index, LPDIRECT3DRMVISUAL* visual)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, cb, arg);
TRACE("(%p)->(%u, %p)\n", iface, index, visual);
return E_NOTIMPL;
}
if (!visual)
return D3DRMERR_BADVALUE;
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddTransform(IDirect3DRMFrame2* iface,
D3DRMCOMBINETYPE type,
D3DRMMATRIX4D matrix)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
*visual = NULL;
TRACE("(%p/%p)->(%u,%p)\n", iface, This, type, matrix);
if (index >= This->size)
return D3DRMERR_BADVALUE;
return IDirect3DRMFrame3_AddTransform(&This->IDirect3DRMFrame3_iface, type, matrix);
IDirect3DRMVisual_AddRef(This->visuals[index]);
*visual = This->visuals[index];
return D3DRM_OK;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddTranslation(IDirect3DRMFrame2* iface,
D3DRMCOMBINETYPE type,
D3DVALUE x, D3DVALUE y, D3DVALUE z)
static const struct IDirect3DRMVisualArrayVtbl Direct3DRMVisualArray_Vtbl =
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
/*** IUnknown methods ***/
IDirect3DRMVisualArrayImpl_QueryInterface,
IDirect3DRMVisualArrayImpl_AddRef,
IDirect3DRMVisualArrayImpl_Release,
/*** IDirect3DRMArray methods ***/
IDirect3DRMVisualArrayImpl_GetSize,
/*** IDirect3DRMVisualArray methods ***/
IDirect3DRMVisualArrayImpl_GetElement
};
FIXME("(%p/%p)->(%u,%f,%f,%f): stub\n", iface, This, type, x, y, z);
HRESULT Direct3DRMVisualArray_create(IDirect3DRMVisualArray** ret_iface)
{
IDirect3DRMVisualArrayImpl* object;
return E_NOTIMPL;
}
TRACE("(%p)\n", ret_iface);
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddScale(IDirect3DRMFrame2* iface,
D3DRMCOMBINETYPE type,
D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
*ret_iface = NULL;
FIXME("(%p/%p)->(%u,%f,%f,%f): stub\n", iface, This, type, sx, sy, sz);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMVisualArrayImpl));
if (!object)
{
ERR("Out of memory\n");
return E_OUTOFMEMORY;
}
return E_NOTIMPL;
object->IDirect3DRMVisualArray_iface.lpVtbl = &Direct3DRMVisualArray_Vtbl;
object->ref = 1;
*ret_iface = &object->IDirect3DRMVisualArray_iface;
return S_OK;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddRotation(IDirect3DRMFrame2* iface,
D3DRMCOMBINETYPE type,
D3DVALUE x, D3DVALUE y, D3DVALUE z,
D3DVALUE theta)
/*** IUnknown methods ***/
static HRESULT WINAPI IDirect3DRMLightArrayImpl_QueryInterface(IDirect3DRMLightArray* iface,
REFIID riid, void** object)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
FIXME("(%p/%p)->(%u,%f,%f,%f,%f): stub\n", iface, This, type, x, y, z, theta);
TRACE("(%p/%p)->(%s, %p)\n", iface, This, debugstr_guid(riid), object);
return E_NOTIMPL;
*object = NULL;
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDirect3DRMLightArray))
{
*object = &This->IDirect3DRMLightArray_iface;
}
else
{
FIXME("interface %s not implemented\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
IDirect3DRMLightArray_AddRef(iface);
return S_OK;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddVisual(IDirect3DRMFrame2* iface,
LPDIRECT3DRMVISUAL vis)
static ULONG WINAPI IDirect3DRMLightArrayImpl_AddRef(IDirect3DRMLightArray* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p/%p)->(%p)\n", iface, This, vis);
TRACE("(%p)->(): new ref = %u\n", This, ref);
return IDirect3DRMFrame3_AddVisual(&This->IDirect3DRMFrame3_iface, (LPUNKNOWN)vis);
return ref;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetChildren(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAMEARRAY *children)
static ULONG WINAPI IDirect3DRMLightArrayImpl_Release(IDirect3DRMLightArray* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
ULONG ref = InterlockedDecrement(&This->ref);
ULONG i;
TRACE("(%p/%p)->(%p)\n", iface, This, children);
TRACE("(%p)->(): new ref = %u\n", This, ref);
return IDirect3DRMFrame3_GetChildren(&This->IDirect3DRMFrame3_iface, children);
if (!ref)
{
for (i = 0; i < This->size; i++)
IDirect3DRMLight_Release(This->lights[i]);
HeapFree(GetProcessHeap(), 0, This->lights);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
static D3DCOLOR WINAPI IDirect3DRMFrame2Impl_GetColor(IDirect3DRMFrame2* iface)
/*** IDirect3DRMArray methods ***/
static DWORD WINAPI IDirect3DRMLightArrayImpl_GetSize(IDirect3DRMLightArray* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
FIXME("(%p/%p)->(): stub\n", iface, This);
TRACE("(%p)->() = %d\n", This, This->size);
return 0;
return This->size;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetLights(IDirect3DRMFrame2* iface,
LPDIRECT3DRMLIGHTARRAY *lights)
/*** IDirect3DRMLightArray methods ***/
static HRESULT WINAPI IDirect3DRMLightArrayImpl_GetElement(IDirect3DRMLightArray* iface, DWORD index, LPDIRECT3DRMLIGHT* light)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, lights);
TRACE("(%p)->(%u, %p)\n", This, index, light);
return IDirect3DRMFrame3_GetLights(&This->IDirect3DRMFrame3_iface, lights);
if (!light)
return D3DRMERR_BADVALUE;
*light = NULL;
if (index >= This->size)
return D3DRMERR_BADVALUE;
IDirect3DRMLight_AddRef(This->lights[index]);
*light = This->lights[index];
return D3DRM_OK;
}
static D3DRMMATERIALMODE WINAPI IDirect3DRMFrame2Impl_GetMaterialMode(IDirect3DRMFrame2* iface)
static const struct IDirect3DRMLightArrayVtbl Direct3DRMLightArray_Vtbl =
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
/*** IUnknown methods ***/
IDirect3DRMLightArrayImpl_QueryInterface,
IDirect3DRMLightArrayImpl_AddRef,
IDirect3DRMLightArrayImpl_Release,
/*** IDirect3DRMArray methods ***/
IDirect3DRMLightArrayImpl_GetSize,
/*** IDirect3DRMLightArray methods ***/
IDirect3DRMLightArrayImpl_GetElement
};
FIXME("(%p/%p)->(): stub\n", iface, This);
HRESULT Direct3DRMLightArray_create(IDirect3DRMLightArray** obj)
{
IDirect3DRMLightArrayImpl* object;
return D3DRMMATERIAL_FROMPARENT;
TRACE("(%p)\n", obj);
*obj = NULL;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMLightArrayImpl));
if (!object)
{
ERR("Out of memory\n");
return E_OUTOFMEMORY;
}
object->IDirect3DRMLightArray_iface.lpVtbl = &Direct3DRMLightArray_Vtbl;
object->ref = 1;
*obj = &object->IDirect3DRMLightArray_iface;
return S_OK;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetParent(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAME * frame)
/*** IUnknown methods ***/
static HRESULT WINAPI IDirect3DRMFrame2Impl_QueryInterface(IDirect3DRMFrame2* iface,
REFIID riid, void** object)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, frame);
TRACE("(%p/%p)->(%s, %p)\n", iface, This, debugstr_guid(riid), object);
if (!frame)
return D3DRMERR_BADVALUE;
*object = NULL;
if (This->parent)
if(IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDirect3DRMFrame) ||
IsEqualGUID(riid, &IID_IDirect3DRMFrame2))
{
*frame = (LPDIRECT3DRMFRAME)&This->parent->IDirect3DRMFrame2_iface;
IDirect3DRMFrame_AddRef(*frame);
*object = &This->IDirect3DRMFrame2_iface;
}
else if(IsEqualGUID(riid, &IID_IDirect3DRMFrame3))
{
*object = &This->IDirect3DRMFrame3_iface;
}
else
{
*frame = NULL;
FIXME("interface %s not implemented\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
return D3DRM_OK;
IDirect3DRMFrame2_AddRef(iface);
return S_OK;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetPosition(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAME reference,
LPD3DVECTOR return_position)
static ULONG WINAPI IDirect3DRMFrame2Impl_AddRef(IDirect3DRMFrame2* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
ULONG ref = InterlockedIncrement(&This->ref);
FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, reference, return_position);
TRACE("(%p)->(): new ref = %d\n", This, ref);
return E_NOTIMPL;
return ref;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetRotation(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAME reference,
LPD3DVECTOR axis, LPD3DVALUE return_theta)
static ULONG WINAPI IDirect3DRMFrame2Impl_Release(IDirect3DRMFrame2* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
ULONG ref = InterlockedDecrement(&This->ref);
ULONG i;
FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, reference, axis, return_theta);
TRACE("(%p)->(): new ref = %d\n", This, ref);
return E_NOTIMPL;
if (!ref)
{
for (i = 0; i < This->nb_children; i++)
IDirect3DRMFrame3_Release(This->children[i]);
HeapFree(GetProcessHeap(), 0, This->children);
for (i = 0; i < This->nb_visuals; i++)
IDirect3DRMVisual_Release(This->visuals[i]);
HeapFree(GetProcessHeap(), 0, This->visuals);
for (i = 0; i < This->nb_lights; i++)
IDirect3DRMLight_Release(This->lights[i]);
HeapFree(GetProcessHeap(), 0, This->lights);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetScene(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAME * frame)
/*** IDirect3DRMObject methods ***/
static HRESULT WINAPI IDirect3DRMFrame2Impl_Clone(IDirect3DRMFrame2* iface,
LPUNKNOWN unkwn, REFIID riid,
LPVOID* object)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
FIXME("(%p/%p)->(%p, %s, %p): stub\n", iface, This, unkwn, debugstr_guid(riid), object);
return E_NOTIMPL;
}
static D3DRMSORTMODE WINAPI IDirect3DRMFrame2Impl_GetSortMode(IDirect3DRMFrame2* iface)
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddDestroyCallback(IDirect3DRMFrame2* iface,
D3DRMOBJECTCALLBACK cb,
LPVOID argument)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(): stub\n", iface, This);
FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
return D3DRMSORT_FROMPARENT;
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetTexture(IDirect3DRMFrame2* iface,
LPDIRECT3DRMTEXTURE * tex)
static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteDestroyCallback(IDirect3DRMFrame2* iface,
D3DRMOBJECTCALLBACK cb,
LPVOID argument)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%p): stub\n", iface, This, tex);
FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetTransform(IDirect3DRMFrame2* iface,
D3DRMMATRIX4D return_matrix)
static HRESULT WINAPI IDirect3DRMFrame2Impl_SetAppData(IDirect3DRMFrame2* iface,
DWORD data)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, return_matrix);
FIXME("(%p/%p)->(%u): stub\n", iface, This, data);
memcpy(&return_matrix[0][0], &This->transform[0][0], sizeof(D3DRMMATRIX4D));
return E_NOTIMPL;
}
return D3DRM_OK;
static DWORD WINAPI IDirect3DRMFrame2Impl_GetAppData(IDirect3DRMFrame2* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(): stub\n", iface, This);
return 0;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetVelocity(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAME reference,
LPD3DVECTOR return_velocity,
BOOL with_rotation)
static HRESULT WINAPI IDirect3DRMFrame2Impl_SetName(IDirect3DRMFrame2* iface, LPCSTR name)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%p,%p,%d): stub\n", iface, This, reference, return_velocity, with_rotation);
FIXME("(%p/%p)->(%s): stub\n", iface, This, name);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetOrientation(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAME reference,
LPD3DVECTOR dir, LPD3DVECTOR up)
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetName(IDirect3DRMFrame2* iface,
LPDWORD size, LPSTR name)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, reference, dir, up);
FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, size, name);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetVisuals(IDirect3DRMFrame2* iface,
LPDIRECT3DRMVISUALARRAY *visuals)
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetClassName(IDirect3DRMFrame2* iface,
LPDWORD size, LPSTR name)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMVisualArrayImpl* obj;
HRESULT hr;
TRACE("(%p/%p)->(%p)\n", iface, This, visuals);
FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, size, name);
if (!visuals)
return D3DRMERR_BADVALUE;
return E_NOTIMPL;
}
hr = Direct3DRMVisualArray_create(visuals);
/*** IDirect3DRMFrame methods ***/
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddChild(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAME child)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMFrameImpl *frame = unsafe_impl_from_IDirect3DRMFrame2((LPDIRECT3DRMFRAME2)child);
if (hr != D3DRM_OK)
return hr;
TRACE("(%p/%p)->(%p)\n", iface, This, child);
if (!frame)
return D3DRMERR_BADOBJECT;
return IDirect3DRMFrame3_AddChild(&This->IDirect3DRMFrame3_iface, &frame->IDirect3DRMFrame3_iface);
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddLight(IDirect3DRMFrame2* iface,
LPDIRECT3DRMLIGHT light)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, light);
return IDirect3DRMFrame3_AddLight(&This->IDirect3DRMFrame3_iface, light);
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddMoveCallback(IDirect3DRMFrame2* iface,
D3DRMFRAMEMOVECALLBACK cb, VOID *arg)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, cb, arg);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddTransform(IDirect3DRMFrame2* iface,
D3DRMCOMBINETYPE type,
D3DRMMATRIX4D matrix)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
TRACE("(%p/%p)->(%u,%p)\n", iface, This, type, matrix);
return IDirect3DRMFrame3_AddTransform(&This->IDirect3DRMFrame3_iface, type, matrix);
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddTranslation(IDirect3DRMFrame2* iface,
D3DRMCOMBINETYPE type,
D3DVALUE x, D3DVALUE y, D3DVALUE z)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%u,%f,%f,%f): stub\n", iface, This, type, x, y, z);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddScale(IDirect3DRMFrame2* iface,
D3DRMCOMBINETYPE type,
D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%u,%f,%f,%f): stub\n", iface, This, type, sx, sy, sz);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddRotation(IDirect3DRMFrame2* iface,
D3DRMCOMBINETYPE type,
D3DVALUE x, D3DVALUE y, D3DVALUE z,
D3DVALUE theta)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%u,%f,%f,%f,%f): stub\n", iface, This, type, x, y, z, theta);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_AddVisual(IDirect3DRMFrame2* iface,
LPDIRECT3DRMVISUAL vis)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, vis);
return IDirect3DRMFrame3_AddVisual(&This->IDirect3DRMFrame3_iface, (LPUNKNOWN)vis);
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetChildren(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAMEARRAY *children)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, children);
return IDirect3DRMFrame3_GetChildren(&This->IDirect3DRMFrame3_iface, children);
}
static D3DCOLOR WINAPI IDirect3DRMFrame2Impl_GetColor(IDirect3DRMFrame2* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(): stub\n", iface, This);
return 0;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetLights(IDirect3DRMFrame2* iface,
LPDIRECT3DRMLIGHTARRAY *lights)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, lights);
return IDirect3DRMFrame3_GetLights(&This->IDirect3DRMFrame3_iface, lights);
}
static D3DRMMATERIALMODE WINAPI IDirect3DRMFrame2Impl_GetMaterialMode(IDirect3DRMFrame2* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(): stub\n", iface, This);
return D3DRMMATERIAL_FROMPARENT;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetParent(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAME * frame)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, frame);
if (!frame)
return D3DRMERR_BADVALUE;
if (This->parent)
{
*frame = (LPDIRECT3DRMFRAME)&This->parent->IDirect3DRMFrame2_iface;
IDirect3DRMFrame_AddRef(*frame);
}
else
{
*frame = NULL;
}
return D3DRM_OK;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetPosition(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAME reference,
LPD3DVECTOR return_position)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, reference, return_position);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetRotation(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAME reference,
LPD3DVECTOR axis, LPD3DVALUE return_theta)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, reference, axis, return_theta);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetScene(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAME * frame)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
return E_NOTIMPL;
}
static D3DRMSORTMODE WINAPI IDirect3DRMFrame2Impl_GetSortMode(IDirect3DRMFrame2* iface)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(): stub\n", iface, This);
return D3DRMSORT_FROMPARENT;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetTexture(IDirect3DRMFrame2* iface,
LPDIRECT3DRMTEXTURE * tex)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%p): stub\n", iface, This, tex);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetTransform(IDirect3DRMFrame2* iface,
D3DRMMATRIX4D return_matrix)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, return_matrix);
memcpy(&return_matrix[0][0], &This->transform[0][0], sizeof(D3DRMMATRIX4D));
return D3DRM_OK;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetVelocity(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAME reference,
LPD3DVECTOR return_velocity,
BOOL with_rotation)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%p,%p,%d): stub\n", iface, This, reference, return_velocity, with_rotation);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetOrientation(IDirect3DRMFrame2* iface,
LPDIRECT3DRMFRAME reference,
LPD3DVECTOR dir, LPD3DVECTOR up)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, reference, dir, up);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetVisuals(IDirect3DRMFrame2* iface,
LPDIRECT3DRMVISUALARRAY *visuals)
{
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
IDirect3DRMVisualArrayImpl* obj;
HRESULT hr;
TRACE("(%p/%p)->(%p)\n", iface, This, visuals);
if (!visuals)
return D3DRMERR_BADVALUE;
hr = Direct3DRMVisualArray_create(visuals);
if (hr != D3DRM_OK)
return hr;
obj = (IDirect3DRMVisualArrayImpl*)*visuals;
......@@ -2344,359 +2696,3 @@ HRESULT Direct3DRMFrame_create(REFIID riid, IUnknown* parent, IUnknown** ret_ifa
return S_OK;
}
/*** IUnknown methods ***/
static HRESULT WINAPI IDirect3DRMFrameArrayImpl_QueryInterface(IDirect3DRMFrameArray* iface,
REFIID riid, void** object)
{
IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
TRACE("(%p/%p)->(%s, %p)\n", iface, This, debugstr_guid(riid), object);
*object = NULL;
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDirect3DRMFrameArray))
{
*object = &This->IDirect3DRMFrameArray_iface;
}
else
{
FIXME("interface %s not implemented\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
IDirect3DRMFrameArray_AddRef(iface);
return S_OK;
}
static ULONG WINAPI IDirect3DRMFrameArrayImpl_AddRef(IDirect3DRMFrameArray* iface)
{
IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(): new ref = %u\n", This, ref);
return ref;
}
static ULONG WINAPI IDirect3DRMFrameArrayImpl_Release(IDirect3DRMFrameArray* iface)
{
IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
ULONG ref = InterlockedDecrement(&This->ref);
ULONG i;
TRACE("(%p)->(): new ref = %u\n", This, ref);
if (!ref)
{
for (i = 0; i < This->size; i++)
IDirect3DRMFrame_Release(This->frames[i]);
HeapFree(GetProcessHeap(), 0, This->frames);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/*** IDirect3DRMArray methods ***/
static DWORD WINAPI IDirect3DRMFrameArrayImpl_GetSize(IDirect3DRMFrameArray* iface)
{
IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
TRACE("(%p)->() = %d\n", This, This->size);
return This->size;
}
/*** IDirect3DRMFrameArray methods ***/
static HRESULT WINAPI IDirect3DRMFrameArrayImpl_GetElement(IDirect3DRMFrameArray* iface, DWORD index, LPDIRECT3DRMFRAME* frame)
{
IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
TRACE("(%p)->(%u, %p)\n", This, index, frame);
if (!frame)
return D3DRMERR_BADVALUE;
*frame = NULL;
if (index >= This->size)
return D3DRMERR_BADVALUE;
IDirect3DRMFrame_AddRef(This->frames[index]);
*frame = This->frames[index];
return D3DRM_OK;
}
static const struct IDirect3DRMFrameArrayVtbl Direct3DRMFrameArray_Vtbl =
{
/*** IUnknown methods ***/
IDirect3DRMFrameArrayImpl_QueryInterface,
IDirect3DRMFrameArrayImpl_AddRef,
IDirect3DRMFrameArrayImpl_Release,
/*** IDirect3DRMArray methods ***/
IDirect3DRMFrameArrayImpl_GetSize,
/*** IDirect3DRMFrameArray methods ***/
IDirect3DRMFrameArrayImpl_GetElement
};
HRESULT Direct3DRMFrameArray_create(IDirect3DRMFrameArray** obj)
{
IDirect3DRMFrameArrayImpl* object;
TRACE("(%p)\n", obj);
*obj = NULL;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMFrameArrayImpl));
if (!object)
{
ERR("Out of memory\n");
return E_OUTOFMEMORY;
}
object->IDirect3DRMFrameArray_iface.lpVtbl = &Direct3DRMFrameArray_Vtbl;
object->ref = 1;
*obj = &object->IDirect3DRMFrameArray_iface;
return S_OK;
}
/*** IUnknown methods ***/
static HRESULT WINAPI IDirect3DRMVisualArrayImpl_QueryInterface(IDirect3DRMVisualArray* iface,
REFIID riid, void** ret_iface)
{
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface);
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDirect3DRMFrameArray))
{
*ret_iface = iface;
IDirect3DRMVisualArray_AddRef(iface);
return S_OK;
}
*ret_iface = NULL;
WARN("Interface %s not implemented\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
static ULONG WINAPI IDirect3DRMVisualArrayImpl_AddRef(IDirect3DRMVisualArray* iface)
{
IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(): new ref = %u\n", iface, ref);
return ref;
}
static ULONG WINAPI IDirect3DRMVisualArrayImpl_Release(IDirect3DRMVisualArray* iface)
{
IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
ULONG ref = InterlockedDecrement(&This->ref);
ULONG i;
TRACE("(%p)->(): new ref = %u\n", iface, ref);
if (!ref)
{
for (i = 0; i < This->size; i++)
IDirect3DRMVisual_Release(This->visuals[i]);
HeapFree(GetProcessHeap(), 0, This->visuals);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/*** IDirect3DRMArray methods ***/
static DWORD WINAPI IDirect3DRMVisualArrayImpl_GetSize(IDirect3DRMVisualArray* iface)
{
IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
TRACE("(%p)->() = %d\n", iface, This->size);
return This->size;
}
/*** IDirect3DRMVisualArray methods ***/
static HRESULT WINAPI IDirect3DRMVisualArrayImpl_GetElement(IDirect3DRMVisualArray* iface, DWORD index, LPDIRECT3DRMVISUAL* visual)
{
IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
TRACE("(%p)->(%u, %p)\n", iface, index, visual);
if (!visual)
return D3DRMERR_BADVALUE;
*visual = NULL;
if (index >= This->size)
return D3DRMERR_BADVALUE;
IDirect3DRMVisual_AddRef(This->visuals[index]);
*visual = This->visuals[index];
return D3DRM_OK;
}
static const struct IDirect3DRMVisualArrayVtbl Direct3DRMVisualArray_Vtbl =
{
/*** IUnknown methods ***/
IDirect3DRMVisualArrayImpl_QueryInterface,
IDirect3DRMVisualArrayImpl_AddRef,
IDirect3DRMVisualArrayImpl_Release,
/*** IDirect3DRMArray methods ***/
IDirect3DRMVisualArrayImpl_GetSize,
/*** IDirect3DRMVisualArray methods ***/
IDirect3DRMVisualArrayImpl_GetElement
};
HRESULT Direct3DRMVisualArray_create(IDirect3DRMVisualArray** ret_iface)
{
IDirect3DRMVisualArrayImpl* object;
TRACE("(%p)\n", ret_iface);
*ret_iface = NULL;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMVisualArrayImpl));
if (!object)
{
ERR("Out of memory\n");
return E_OUTOFMEMORY;
}
object->IDirect3DRMVisualArray_iface.lpVtbl = &Direct3DRMVisualArray_Vtbl;
object->ref = 1;
*ret_iface = &object->IDirect3DRMVisualArray_iface;
return S_OK;
}
/*** IUnknown methods ***/
static HRESULT WINAPI IDirect3DRMLightArrayImpl_QueryInterface(IDirect3DRMLightArray* iface,
REFIID riid, void** object)
{
IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
TRACE("(%p/%p)->(%s, %p)\n", iface, This, debugstr_guid(riid), object);
*object = NULL;
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDirect3DRMLightArray))
{
*object = &This->IDirect3DRMLightArray_iface;
}
else
{
FIXME("interface %s not implemented\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
IDirect3DRMLightArray_AddRef(iface);
return S_OK;
}
static ULONG WINAPI IDirect3DRMLightArrayImpl_AddRef(IDirect3DRMLightArray* iface)
{
IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(): new ref = %u\n", This, ref);
return ref;
}
static ULONG WINAPI IDirect3DRMLightArrayImpl_Release(IDirect3DRMLightArray* iface)
{
IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
ULONG ref = InterlockedDecrement(&This->ref);
ULONG i;
TRACE("(%p)->(): new ref = %u\n", This, ref);
if (!ref)
{
for (i = 0; i < This->size; i++)
IDirect3DRMLight_Release(This->lights[i]);
HeapFree(GetProcessHeap(), 0, This->lights);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/*** IDirect3DRMArray methods ***/
static DWORD WINAPI IDirect3DRMLightArrayImpl_GetSize(IDirect3DRMLightArray* iface)
{
IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
TRACE("(%p)->() = %d\n", This, This->size);
return This->size;
}
/*** IDirect3DRMLightArray methods ***/
static HRESULT WINAPI IDirect3DRMLightArrayImpl_GetElement(IDirect3DRMLightArray* iface, DWORD index, LPDIRECT3DRMLIGHT* light)
{
IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
TRACE("(%p)->(%u, %p)\n", This, index, light);
if (!light)
return D3DRMERR_BADVALUE;
*light = NULL;
if (index >= This->size)
return D3DRMERR_BADVALUE;
IDirect3DRMLight_AddRef(This->lights[index]);
*light = This->lights[index];
return D3DRM_OK;
}
static const struct IDirect3DRMLightArrayVtbl Direct3DRMLightArray_Vtbl =
{
/*** IUnknown methods ***/
IDirect3DRMLightArrayImpl_QueryInterface,
IDirect3DRMLightArrayImpl_AddRef,
IDirect3DRMLightArrayImpl_Release,
/*** IDirect3DRMArray methods ***/
IDirect3DRMLightArrayImpl_GetSize,
/*** IDirect3DRMLightArray methods ***/
IDirect3DRMLightArrayImpl_GetElement
};
HRESULT Direct3DRMLightArray_create(IDirect3DRMLightArray** obj)
{
IDirect3DRMLightArrayImpl* object;
TRACE("(%p)\n", obj);
*obj = NULL;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMLightArrayImpl));
if (!object)
{
ERR("Out of memory\n");
return E_OUTOFMEMORY;
}
object->IDirect3DRMLightArray_iface.lpVtbl = &Direct3DRMLightArray_Vtbl;
object->ref = 1;
*obj = &object->IDirect3DRMLightArray_iface;
return S_OK;
}
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