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;
|
||||
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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue