Nikolay Sivov : d3drm: Use existing helper to manage mesh groups.
Alexandre Julliard
julliard at winehq.org
Mon Jul 10 15:52:46 CDT 2017
Module: wine
Branch: master
Commit: 2d9089d8aae5ab6ffa1bff5813f4047988130b3a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2d9089d8aae5ab6ffa1bff5813f4047988130b3a
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Jul 10 13:40:49 2017 +0300
d3drm: Use existing helper to manage mesh groups.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3drm/d3drm_private.h | 4 ++--
dlls/d3drm/meshbuilder.c | 24 ++----------------------
2 files changed, 4 insertions(+), 24 deletions(-)
diff --git a/dlls/d3drm/d3drm_private.h b/dlls/d3drm/d3drm_private.h
index 861c3ab..65e0016 100644
--- a/dlls/d3drm/d3drm_private.h
+++ b/dlls/d3drm/d3drm_private.h
@@ -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;
};
diff --git a/dlls/d3drm/meshbuilder.c b/dlls/d3drm/meshbuilder.c
index bb37678..c95cb46 100644
--- a/dlls/d3drm/meshbuilder.c
+++ b/dlls/d3drm/meshbuilder.c
@@ -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;
More information about the wine-cvs
mailing list