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/displist.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/displist.c')
-rw-r--r--source/blender/blenkernel/intern/displist.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 77ec333c173..6a89ca2cb84 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -43,6 +43,7 @@
#include "DNA_material_types.h"
#include "BLI_blenlib.h"
+#include "BLI_memarena.h"
#include "BLI_math.h"
#include "BLI_scanfill.h"
#include "BLI_utildefines.h"
@@ -450,6 +451,7 @@ void BKE_displist_fill(ListBase *dispbase, ListBase *to, const float normal_proj
ScanFillContext sf_ctx;
ScanFillVert *sf_vert, *sf_vert_new, *sf_vert_last;
ScanFillFace *sf_tri;
+ MemArena *sf_arena;
DispList *dlnew = NULL, *dl;
float *f1;
int colnr = 0, charidx = 0, cont = 1, tot, a, *index, nextcol = 0;
@@ -460,12 +462,14 @@ void BKE_displist_fill(ListBase *dispbase, ListBase *to, const float normal_proj
if (dispbase->first == NULL)
return;
+ sf_arena = BLI_memarena_new(BLI_SCANFILL_ARENA_SIZE, __func__);
+
while (cont) {
cont = 0;
totvert = 0;
nextcol = 0;
- BLI_scanfill_begin(&sf_ctx);
+ BLI_scanfill_begin_arena(&sf_ctx, sf_arena);
dl = dispbase->first;
while (dl) {
@@ -553,7 +557,7 @@ void BKE_displist_fill(ListBase *dispbase, ListBase *to, const float normal_proj
BLI_addhead(to, dlnew);
}
- BLI_scanfill_end(&sf_ctx);
+ BLI_scanfill_end_arena(&sf_ctx, sf_arena);
if (nextcol) {
/* stay at current char but fill polys with next material */
@@ -566,6 +570,8 @@ void BKE_displist_fill(ListBase *dispbase, ListBase *to, const float normal_proj
}
}
+ BLI_memarena_free(sf_arena);
+
/* do not free polys, needed for wireframe display */
}