Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2009-09-10 05:46:52 +0400
committerJoseph Eagar <joeedh@gmail.com>2009-09-10 05:46:52 +0400
commitb0a1904d33a1c097a8e8fd56fe9b3c1d3a34ca55 (patch)
tree7a89f984f91cc4c20b365219f9de5663122a01ae /source/blender/editors/object
parentae446d79e027cf4eb6ea7290ea24c536711249d8 (diff)
another optimization pass. biggest change is MDeformGroup->dw is now allocated via a somewhat simplistic, if effective allocator. This needs a little bit more work; I'd really prefer building this into guardedalloc, but the method requires mempools, which currently live in blenlib. and I'm not sure if we can have guardedalloc linking with blenlib? anyway, current allocator code is more of a temporary fix until I figure that out.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_vgroup.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 154ab14df60..789cfaa840d 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -47,6 +47,7 @@
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
+#include "BLI_cellalloc.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
@@ -185,10 +186,10 @@ MDeformWeight *verify_defweight (MDeformVert *dv, int defgroup)
if (newdw)
return newdw;
- newdw = MEM_callocN (sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight");
+ newdw = BLI_cellalloc_calloc(sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight");
if (dv->dw){
memcpy (newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight);
- MEM_freeN (dv->dw);
+ BLI_cellalloc_free (dv->dw);
}
dv->dw=newdw;
@@ -577,13 +578,13 @@ void remove_vert_def_nr (Object *ob, int def_nr, int vertnum)
* deform weight, and reshuffle the others
*/
if (dvert->totweight) {
- newdw = MEM_mallocN (sizeof(MDeformWeight)*(dvert->totweight),
+ newdw = BLI_cellalloc_malloc (sizeof(MDeformWeight)*(dvert->totweight),
"deformWeight");
if (dvert->dw){
memcpy (newdw, dvert->dw, sizeof(MDeformWeight)*i);
memcpy (newdw+i, dvert->dw+i+1,
sizeof(MDeformWeight)*(dvert->totweight-i));
- MEM_freeN (dvert->dw);
+ BLI_cellalloc_free (dvert->dw);
}
dvert->dw=newdw;
}
@@ -591,7 +592,7 @@ void remove_vert_def_nr (Object *ob, int def_nr, int vertnum)
* left then just remove the deform weight
*/
else {
- MEM_freeN (dvert->dw);
+ BLI_cellalloc_free (dvert->dw);
dvert->dw = NULL;
break;
}
@@ -677,11 +678,11 @@ void add_vert_defnr (Object *ob, int def_nr, int vertnum,
/* if we are doing an additive assignment, then
* we need to create the deform weight
*/
- newdw = MEM_callocN (sizeof(MDeformWeight)*(dv->totweight+1),
+ newdw = BLI_cellalloc_calloc (sizeof(MDeformWeight)*(dv->totweight+1),
"deformWeight");
if (dv->dw){
memcpy (newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight);
- MEM_freeN (dv->dw);
+ BLI_cellalloc_free (dv->dw);
}
dv->dw=newdw;
@@ -772,10 +773,10 @@ void assign_verts_defgroup (Object *ob, float weight)
}
/* If not: Add the group and set its weight */
if (!done){
- newdw = MEM_callocN (sizeof(MDeformWeight)*(dvert->totweight+1), "deformWeight");
+ newdw = BLI_cellalloc_calloc (sizeof(MDeformWeight)*(dvert->totweight+1), "deformWeight");
if (dvert->dw){
memcpy (newdw, dvert->dw, sizeof(MDeformWeight)*dvert->totweight);
- MEM_freeN (dvert->dw);
+ BLI_cellalloc_free (dvert->dw);
}
dvert->dw=newdw;
@@ -918,7 +919,7 @@ void remove_verts_defgroup (Object *ob, int allverts)
if (eg == dg){
dvert->totweight--;
if (dvert->totweight){
- newdw = MEM_mallocN (sizeof(MDeformWeight)*(dvert->totweight), "deformWeight");
+ newdw = BLI_cellalloc_malloc (sizeof(MDeformWeight)*(dvert->totweight), "deformWeight");
if (dvert->dw){
memcpy (newdw, dvert->dw, sizeof(MDeformWeight)*i);
@@ -928,7 +929,7 @@ void remove_verts_defgroup (Object *ob, int allverts)
dvert->dw=newdw;
}
else{
- MEM_freeN (dvert->dw);
+ BLI_cellalloc_free (dvert->dw);
dvert->dw=NULL;
break;
}