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:
authorCampbell Barton <ideasman42@gmail.com>2013-08-28 06:07:54 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-08-28 06:07:54 +0400
commit27df6a3b546bf4188b0f29bcb90df201a6730574 (patch)
tree2669a91593815f28dd15177ef6620778d5259909 /source/blender/blenkernel/intern/mesh.c
parent4d2b50ad74f29a4a22eb8a3376552430b2c0666d (diff)
scanfill curves, ngons, masks had their own memarena code and would allocate a new one for every fill.
now use BLI_memarena and support passing the arena into the fill function, so the arena is re-used, when scanfill is called in a loop.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r--source/blender/blenkernel/intern/mesh.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 9465044ba0b..0d3bc1b71e3 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -46,6 +46,7 @@
#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
+#include "BLI_memarena.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_bitmap.h"
@@ -2733,6 +2734,7 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
ScanFillContext sf_ctx;
ScanFillVert *sf_vert, *sf_vert_last, *sf_vert_first;
ScanFillFace *sf_tri;
+ MemArena *sf_arena = NULL;
int *mface_to_poly_map;
int lindex[4]; /* only ever use 3 in this case */
int poly_index, j, mface_index;
@@ -2815,7 +2817,11 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
#endif
ml = mloop + mp->loopstart;
- BLI_scanfill_begin(&sf_ctx);
+ if (UNLIKELY(sf_arena == NULL)) {
+ sf_arena = BLI_memarena_new(BLI_SCANFILL_ARENA_SIZE, __func__);
+ }
+
+ BLI_scanfill_begin_arena(&sf_ctx, sf_arena);
sf_vert_first = NULL;
sf_vert_last = NULL;
for (j = 0; j < mp->totloop; j++, ml++) {
@@ -2867,12 +2873,17 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
mface_index++;
}
- BLI_scanfill_end(&sf_ctx);
+ BLI_scanfill_end_arena(&sf_ctx, sf_arena);
#undef USE_TESSFACE_CALCNORMAL
}
}
+ if (sf_arena) {
+ BLI_memarena_free(sf_arena);
+ sf_arena = NULL;
+ }
+
CustomData_free(fdata, totface);
totface = mface_index;