[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59936] trunk/blender/source/blender/ blenkernel/intern/mesh_evaluate.c: remove use of BLI_array in BKE_mesh_mpoly_to_mface().
Campbell Barton
ideasman42 at gmail.com
Mon Sep 9 04:16:25 CEST 2013
Revision: 59936
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59936
Author: campbellbarton
Date: 2013-09-09 02:16:22 +0000 (Mon, 09 Sep 2013)
Log Message:
-----------
remove use of BLI_array in BKE_mesh_mpoly_to_mface(). was over-allocating anyway so just allocate the array once.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/mesh_evaluate.c
Modified: trunk/blender/source/blender/blenkernel/intern/mesh_evaluate.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mesh_evaluate.c 2013-09-09 02:11:44 UTC (rev 59935)
+++ trunk/blender/source/blender/blenkernel/intern/mesh_evaluate.c 2013-09-09 02:16:22 UTC (rev 59936)
@@ -42,7 +42,6 @@
#include "BLI_bitmap.h"
#include "BLI_scanfill.h"
#include "BLI_alloca.h"
-#include "BLI_array.h"
#include "BKE_customdata.h"
#include "BKE_mesh.h"
@@ -1288,14 +1287,16 @@
int k;
MPoly *mp, *mpoly;
- MFace *mface = NULL, *mf;
- BLI_array_declare(mface);
+ MFace *mface, *mf;
const int numTex = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
const int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
const bool hasPCol = CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL);
const bool hasOrigSpace = CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP);
+ /* over-alloc, ngons will be skipped */
+ mface = MEM_mallocN(sizeof(*mface) * (size_t)totpoly, __func__);
+
mpoly = CustomData_get_layer(pdata, CD_MPOLY);
mloop = CustomData_get_layer(ldata, CD_MLOOP);
@@ -1303,7 +1304,6 @@
k = 0;
for (i = 0; i < totpoly; i++, mp++) {
if (ELEM(mp->totloop, 3, 4)) {
- BLI_array_grow_one(mface);
mf = &mface[k];
mf->mat_nr = mp->mat_nr;
More information about the Bf-blender-cvs
mailing list