d3drm: Use existing helper to manage mesh groups.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
671ac168e2
commit
2d9089d8aa
|
@ -168,8 +168,8 @@ struct d3drm_mesh
|
||||||
IDirect3DRMMesh IDirect3DRMMesh_iface;
|
IDirect3DRMMesh IDirect3DRMMesh_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
IDirect3DRM *d3drm;
|
IDirect3DRM *d3drm;
|
||||||
DWORD groups_capacity;
|
SIZE_T nb_groups;
|
||||||
DWORD nb_groups;
|
SIZE_T groups_size;
|
||||||
struct mesh_group *groups;
|
struct mesh_group *groups;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2532,29 +2532,9 @@ static HRESULT WINAPI d3drm_mesh_AddGroup(IDirect3DRMMesh *iface, unsigned verte
|
||||||
if (!face_data || !id)
|
if (!face_data || !id)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
if ((mesh->nb_groups + 1) > mesh->groups_capacity)
|
if (!d3drm_array_reserve((void **)&mesh->groups, &mesh->groups_size, mesh->nb_groups + 1, sizeof(*mesh->groups)))
|
||||||
{
|
|
||||||
struct mesh_group *groups;
|
|
||||||
ULONG new_capacity;
|
|
||||||
|
|
||||||
if (!mesh->groups_capacity)
|
|
||||||
{
|
|
||||||
new_capacity = 16;
|
|
||||||
groups = HeapAlloc(GetProcessHeap(), 0, new_capacity * sizeof(*groups));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
new_capacity = mesh->groups_capacity * 2;
|
|
||||||
groups = HeapReAlloc(GetProcessHeap(), 0, mesh->groups, new_capacity * sizeof(*groups));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!groups)
|
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
mesh->groups_capacity = new_capacity;
|
|
||||||
mesh->groups = groups;
|
|
||||||
}
|
|
||||||
|
|
||||||
group = mesh->groups + mesh->nb_groups;
|
group = mesh->groups + mesh->nb_groups;
|
||||||
|
|
||||||
group->vertices = HeapAlloc(GetProcessHeap(), 0, vertex_count * sizeof(D3DRMVERTEX));
|
group->vertices = HeapAlloc(GetProcessHeap(), 0, vertex_count * sizeof(D3DRMVERTEX));
|
||||||
|
|
Loading…
Reference in New Issue