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>
oldstable
Nikolay Sivov 2017-07-10 13:40:49 +03:00 committed by Alexandre Julliard
parent 671ac168e2
commit 2d9089d8aa
2 changed files with 4 additions and 24 deletions

View File

@ -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;
};

View File

@ -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;