Commit b3903a13 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3drm: Use existing helper to manage child frames array.

parent 6f22d670
......@@ -65,8 +65,8 @@ struct d3drm_frame
IDirect3DRM *d3drm;
LONG ref;
struct d3drm_frame *parent;
ULONG nb_children;
ULONG children_capacity;
SIZE_T nb_children;
SIZE_T children_size;
IDirect3DRMFrame3 **children;
ULONG nb_visuals;
ULONG visuals_capacity;
......
......@@ -807,7 +807,7 @@ static HRESULT WINAPI d3drm_frame1_GetClassName(IDirect3DRMFrame *iface, DWORD *
static HRESULT WINAPI d3drm_frame3_AddChild(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *child)
{
struct d3drm_frame *This = impl_from_IDirect3DRMFrame3(iface);
struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
struct d3drm_frame *child_obj = unsafe_impl_from_IDirect3DRMFrame3(child);
TRACE("iface %p, child %p.\n", iface, child);
......@@ -831,32 +831,13 @@ static HRESULT WINAPI d3drm_frame3_AddChild(IDirect3DRMFrame3 *iface, IDirect3DR
}
}
if ((This->nb_children + 1) > This->children_capacity)
{
ULONG new_capacity;
IDirect3DRMFrame3** children;
if (!This->children_capacity)
{
new_capacity = 16;
children = HeapAlloc(GetProcessHeap(), 0, new_capacity * sizeof(IDirect3DRMFrame3*));
}
else
{
new_capacity = This->children_capacity * 2;
children = HeapReAlloc(GetProcessHeap(), 0, This->children, new_capacity * sizeof(IDirect3DRMFrame3*));
}
if (!children)
return E_OUTOFMEMORY;
This->children_capacity = new_capacity;
This->children = children;
}
if (!d3drm_array_reserve((void **)&frame->children, &frame->children_size,
frame->nb_children + 1, sizeof(*frame->children)))
return E_OUTOFMEMORY;
This->children[This->nb_children++] = child;
frame->children[frame->nb_children++] = child;
IDirect3DRMFrame3_AddRef(child);
child_obj->parent = This;
child_obj->parent = frame;
return D3DRM_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