Commit 2d9089d8 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3drm: Use existing helper to manage mesh groups.

parent 671ac168
......@@ -168,8 +168,8 @@ struct d3drm_mesh
IDirect3DRMMesh IDirect3DRMMesh_iface;
LONG ref;
IDirect3DRM *d3drm;
DWORD groups_capacity;
DWORD nb_groups;
SIZE_T nb_groups;
SIZE_T groups_size;
struct mesh_group *groups;
};
......
......@@ -2532,28 +2532,8 @@ static HRESULT WINAPI d3drm_mesh_AddGroup(IDirect3DRMMesh *iface, unsigned verte
if (!face_data || !id)
return E_POINTER;
if ((mesh->nb_groups + 1) > mesh->groups_capacity)
{
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;
mesh->groups_capacity = new_capacity;
mesh->groups = groups;
}
if (!d3drm_array_reserve((void **)&mesh->groups, &mesh->groups_size, mesh->nb_groups + 1, sizeof(*mesh->groups)))
return E_OUTOFMEMORY;
group = mesh->groups + mesh->nb_groups;
......
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