d3drm: Get rid of the IDirect3DRMVisualArrayImpl typedef.
This commit is contained in:
parent
cb49cff060
commit
3ffd998c46
|
@ -65,12 +65,13 @@ typedef struct {
|
||||||
IDirect3DRMFrame **frames;
|
IDirect3DRMFrame **frames;
|
||||||
} IDirect3DRMFrameArrayImpl;
|
} IDirect3DRMFrameArrayImpl;
|
||||||
|
|
||||||
typedef struct {
|
struct d3drm_visual_array
|
||||||
|
{
|
||||||
IDirect3DRMVisualArray IDirect3DRMVisualArray_iface;
|
IDirect3DRMVisualArray IDirect3DRMVisualArray_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
ULONG size;
|
ULONG size;
|
||||||
IDirect3DRMVisual **visuals;
|
IDirect3DRMVisual **visuals;
|
||||||
} IDirect3DRMVisualArrayImpl;
|
};
|
||||||
|
|
||||||
struct d3drm_light_array
|
struct d3drm_light_array
|
||||||
{
|
{
|
||||||
|
@ -97,9 +98,9 @@ static inline IDirect3DRMFrameArrayImpl *impl_from_IDirect3DRMFrameArray(IDirect
|
||||||
return CONTAINING_RECORD(iface, IDirect3DRMFrameArrayImpl, IDirect3DRMFrameArray_iface);
|
return CONTAINING_RECORD(iface, IDirect3DRMFrameArrayImpl, IDirect3DRMFrameArray_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline IDirect3DRMVisualArrayImpl *impl_from_IDirect3DRMVisualArray(IDirect3DRMVisualArray *iface)
|
static inline struct d3drm_visual_array *impl_from_IDirect3DRMVisualArray(IDirect3DRMVisualArray *iface)
|
||||||
{
|
{
|
||||||
return CONTAINING_RECORD(iface, IDirect3DRMVisualArrayImpl, IDirect3DRMVisualArray_iface);
|
return CONTAINING_RECORD(iface, struct d3drm_visual_array, IDirect3DRMVisualArray_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct d3drm_light_array *impl_from_IDirect3DRMLightArray(IDirect3DRMLightArray *iface)
|
static inline struct d3drm_light_array *impl_from_IDirect3DRMLightArray(IDirect3DRMLightArray *iface)
|
||||||
|
@ -218,7 +219,7 @@ static HRESULT Direct3DRMFrameArray_create(IDirect3DRMFrameArray** obj)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirect3DRMVisualArrayImpl_QueryInterface(IDirect3DRMVisualArray *iface, REFIID riid, void **out)
|
static HRESULT WINAPI d3drm_visual_array_QueryInterface(IDirect3DRMVisualArray *iface, REFIID riid, void **out)
|
||||||
{
|
{
|
||||||
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
|
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
|
||||||
|
|
||||||
|
@ -236,97 +237,88 @@ static HRESULT WINAPI IDirect3DRMVisualArrayImpl_QueryInterface(IDirect3DRMVisua
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI IDirect3DRMVisualArrayImpl_AddRef(IDirect3DRMVisualArray* iface)
|
static ULONG WINAPI d3drm_visual_array_AddRef(IDirect3DRMVisualArray *iface)
|
||||||
{
|
{
|
||||||
IDirect3DRMVisualArrayImpl *This = impl_from_IDirect3DRMVisualArray(iface);
|
struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface);
|
||||||
ULONG ref = InterlockedIncrement(&This->ref);
|
ULONG refcount = InterlockedIncrement(&array->ref);
|
||||||
|
|
||||||
TRACE("(%p)->(): new ref = %u\n", iface, ref);
|
TRACE("%p increasing refcount to %u.\n", iface, refcount);
|
||||||
|
|
||||||
return ref;
|
return refcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI IDirect3DRMVisualArrayImpl_Release(IDirect3DRMVisualArray* iface)
|
static ULONG WINAPI d3drm_visual_array_Release(IDirect3DRMVisualArray *iface)
|
||||||
{
|
{
|
||||||
IDirect3DRMVisualArrayImpl *This = impl_from_IDirect3DRMVisualArray(iface);
|
struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface);
|
||||||
ULONG ref = InterlockedDecrement(&This->ref);
|
ULONG refcount = InterlockedDecrement(&array->ref);
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
TRACE("(%p)->(): new ref = %u\n", iface, ref);
|
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
|
||||||
|
|
||||||
if (!ref)
|
if (!refcount)
|
||||||
{
|
{
|
||||||
for (i = 0; i < This->size; i++)
|
for (i = 0; i < array->size; ++i)
|
||||||
IDirect3DRMVisual_Release(This->visuals[i]);
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, This->visuals);
|
IDirect3DRMVisual_Release(array->visuals[i]);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
}
|
||||||
|
HeapFree(GetProcessHeap(), 0, array->visuals);
|
||||||
|
HeapFree(GetProcessHeap(), 0, array);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ref;
|
return refcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** IDirect3DRMArray methods ***/
|
static DWORD WINAPI d3drm_visual_array_GetSize(IDirect3DRMVisualArray *iface)
|
||||||
static DWORD WINAPI IDirect3DRMVisualArrayImpl_GetSize(IDirect3DRMVisualArray* iface)
|
|
||||||
{
|
{
|
||||||
IDirect3DRMVisualArrayImpl *This = impl_from_IDirect3DRMVisualArray(iface);
|
struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface);
|
||||||
|
|
||||||
TRACE("(%p)->() = %d\n", iface, This->size);
|
TRACE("iface %p.\n", iface);
|
||||||
|
|
||||||
return This->size;
|
return array->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** IDirect3DRMVisualArray methods ***/
|
static HRESULT WINAPI d3drm_visual_array_GetElement(IDirect3DRMVisualArray *iface,
|
||||||
static HRESULT WINAPI IDirect3DRMVisualArrayImpl_GetElement(IDirect3DRMVisualArray *iface,
|
|
||||||
DWORD index, IDirect3DRMVisual **visual)
|
DWORD index, IDirect3DRMVisual **visual)
|
||||||
{
|
{
|
||||||
IDirect3DRMVisualArrayImpl *This = impl_from_IDirect3DRMVisualArray(iface);
|
struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface);
|
||||||
|
|
||||||
TRACE("(%p)->(%u, %p)\n", iface, index, visual);
|
TRACE("iface %p, index %u, visual %p.\n", iface, index, visual);
|
||||||
|
|
||||||
if (!visual)
|
if (!visual)
|
||||||
return D3DRMERR_BADVALUE;
|
return D3DRMERR_BADVALUE;
|
||||||
|
|
||||||
*visual = NULL;
|
if (index >= array->size)
|
||||||
|
{
|
||||||
if (index >= This->size)
|
*visual = NULL;
|
||||||
return D3DRMERR_BADVALUE;
|
return D3DRMERR_BADVALUE;
|
||||||
|
}
|
||||||
|
|
||||||
IDirect3DRMVisual_AddRef(This->visuals[index]);
|
IDirect3DRMVisual_AddRef(array->visuals[index]);
|
||||||
*visual = This->visuals[index];
|
*visual = array->visuals[index];
|
||||||
|
|
||||||
return D3DRM_OK;
|
return D3DRM_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct IDirect3DRMVisualArrayVtbl Direct3DRMVisualArray_Vtbl =
|
static const struct IDirect3DRMVisualArrayVtbl d3drm_visual_array_vtbl =
|
||||||
{
|
{
|
||||||
/*** IUnknown methods ***/
|
d3drm_visual_array_QueryInterface,
|
||||||
IDirect3DRMVisualArrayImpl_QueryInterface,
|
d3drm_visual_array_AddRef,
|
||||||
IDirect3DRMVisualArrayImpl_AddRef,
|
d3drm_visual_array_Release,
|
||||||
IDirect3DRMVisualArrayImpl_Release,
|
d3drm_visual_array_GetSize,
|
||||||
/*** IDirect3DRMArray methods ***/
|
d3drm_visual_array_GetElement,
|
||||||
IDirect3DRMVisualArrayImpl_GetSize,
|
|
||||||
/*** IDirect3DRMVisualArray methods ***/
|
|
||||||
IDirect3DRMVisualArrayImpl_GetElement
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT Direct3DRMVisualArray_create(IDirect3DRMVisualArray** ret_iface)
|
static struct d3drm_visual_array *d3drm_visual_array_create(void)
|
||||||
{
|
{
|
||||||
IDirect3DRMVisualArrayImpl* object;
|
struct d3drm_visual_array *array;
|
||||||
|
|
||||||
TRACE("(%p)\n", ret_iface);
|
if (!(array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*array))))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
*ret_iface = NULL;
|
array->IDirect3DRMVisualArray_iface.lpVtbl = &d3drm_visual_array_vtbl;
|
||||||
|
array->ref = 1;
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMVisualArrayImpl));
|
return array;
|
||||||
if (!object)
|
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
|
|
||||||
object->IDirect3DRMVisualArray_iface.lpVtbl = &Direct3DRMVisualArray_Vtbl;
|
|
||||||
object->ref = 1;
|
|
||||||
|
|
||||||
*ret_iface = &object->IDirect3DRMVisualArray_iface;
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_light_array_QueryInterface(IDirect3DRMLightArray *iface, REFIID riid, void **out)
|
static HRESULT WINAPI d3drm_light_array_QueryInterface(IDirect3DRMLightArray *iface, REFIID riid, void **out)
|
||||||
|
@ -789,34 +781,32 @@ static HRESULT WINAPI IDirect3DRMFrame2Impl_GetOrientation(IDirect3DRMFrame2 *if
|
||||||
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetVisuals(IDirect3DRMFrame2 *iface, IDirect3DRMVisualArray **visuals)
|
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetVisuals(IDirect3DRMFrame2 *iface, IDirect3DRMVisualArray **visuals)
|
||||||
{
|
{
|
||||||
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
|
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
|
||||||
IDirect3DRMVisualArrayImpl* obj;
|
struct d3drm_visual_array *array;
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
TRACE("(%p/%p)->(%p)\n", iface, This, visuals);
|
TRACE("iface %p, visuals %p.\n", iface, visuals);
|
||||||
|
|
||||||
if (!visuals)
|
if (!visuals)
|
||||||
return D3DRMERR_BADVALUE;
|
return D3DRMERR_BADVALUE;
|
||||||
|
|
||||||
hr = Direct3DRMVisualArray_create(visuals);
|
if (!(array = d3drm_visual_array_create()))
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
if (hr != D3DRM_OK)
|
array->size = This->nb_visuals;
|
||||||
return hr;
|
|
||||||
|
|
||||||
obj = (IDirect3DRMVisualArrayImpl*)*visuals;
|
|
||||||
|
|
||||||
obj->size = This->nb_visuals;
|
|
||||||
if (This->nb_visuals)
|
if (This->nb_visuals)
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG i;
|
||||||
if (!(obj->visuals = HeapAlloc(GetProcessHeap(), 0, This->nb_visuals * sizeof(*obj->visuals))))
|
|
||||||
|
if (!(array->visuals = HeapAlloc(GetProcessHeap(), 0, This->nb_visuals * sizeof(*array->visuals))))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
for (i = 0; i < This->nb_visuals; i++)
|
for (i = 0; i < This->nb_visuals; i++)
|
||||||
{
|
{
|
||||||
obj->visuals[i] = This->visuals[i];
|
array->visuals[i] = This->visuals[i];
|
||||||
IDirect3DRMVisual_AddRef(This->visuals[i]);
|
IDirect3DRMVisual_AddRef(This->visuals[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*visuals = &array->IDirect3DRMVisualArray_iface;
|
||||||
|
|
||||||
return D3DRM_OK;
|
return D3DRM_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue