diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-23 17:51:44 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-23 17:51:44 +0400 |
commit | 41c0f0c733fa111850da6a772dabb6115808c7b7 (patch) | |
tree | 0754c79f41813138641a640210dbe20658eee0a4 /source/blender/blenkernel/intern | |
parent | 001a15a721aed6dc7d84de64288f566f08820932 (diff) |
replace BLI_array_growone() with BLI_array_growitems() when the size of the increase is known ahead of time, will reduce reallocs and give some speedup.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifiers_bmesh.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 11 |
3 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 6a98ab324cb..67a4d6657c9 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1112,8 +1112,8 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag, for (i=0; i<dm->numPolyData; i++, mp++) { ml = mloop + mp->loopstart; - for (j=0; j<mp->totloop; j++, ml++, totloop++) { - BLI_array_growone(wtcol_l); + BLI_array_growitems(wtcol_l, mp->totloop); + for (j = 0; j < mp->totloop; j++, ml++, totloop++) { copy_v4_v4_char((char *)&wtcol_l[totloop], (char *)&wtcol_v[4 * ml->v]); } diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c index 3d1349f09ed..c54a622be7e 100644 --- a/source/blender/blenkernel/intern/modifiers_bmesh.c +++ b/source/blender/blenkernel/intern/modifiers_bmesh.c @@ -171,10 +171,11 @@ BMEditMesh *CDDM_To_BMesh(Object *ob, DerivedMesh *dm, BMEditMesh *existing, int BLI_array_empty(verts); BLI_array_empty(edges); + BLI_array_growitems(verts, mp->totloop); + BLI_array_growitems(edges, mp->totloop); + ml = mloop + mp->loopstart; - for (j=0; j<mp->totloop; j++, ml++) { - BLI_array_growone(verts); - BLI_array_growone(edges); + for (j = 0; j < mp->totloop; j++, ml++) { verts[j] = vtable[ml->v]; edges[j] = etable[ml->e]; diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 76077fe3a14..f8fec9911fb 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -3040,17 +3040,16 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, /* set the face base vert */ *((int*)ccgSubSurf_getFaceUserData(ss, f)) = vertNum; - BLI_array_empty(loopidx); - for (s=0; s<numVerts; s++) { - BLI_array_growone(loopidx); + BLI_array_empty(loopidx); + BLI_array_growitems(loopidx, numVerts); + for (s = 0; s < numVerts; s++) { loopidx[s] = loopindex++; } BLI_array_empty(vertidx); - for(s = 0; s < numVerts; s++) { + BLI_array_growitems(vertidx, numVerts); + for (s = 0; s < numVerts; s++) { CCGVert *v = ccgSubSurf_getFaceVert(ss, f, s); - - BLI_array_growone(vertidx); vertidx[s] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); } |