[Bf-blender-cvs] [51e3735653b] greasepencil-object: Fix wrong allocation

Antonio Vazquez noreply at git.blender.org
Mon Oct 23 20:10:15 CEST 2017


Commit: 51e3735653ba7945425b14536fa06b0ea8cc6800
Author: Antonio Vazquez
Date:   Mon Oct 23 20:09:53 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB51e3735653ba7945425b14536fa06b0ea8cc6800

Fix wrong allocation

The allocation was allocating batches, but must be an array of pointers to batches.

===================================================================

M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c

===================================================================

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 6ae82eb7112..d38c014eda6 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -153,10 +153,10 @@ static bool gpencil_batch_cache_valid(Object *ob, bGPdata *gpd, int cfra)
 static void gpencil_batch_cache_resize(GpencilBatchCache *cache, int slots)
 {
 	cache->cache_size = slots;
-	cache->batch_stroke = MEM_recallocN(cache->batch_stroke, sizeof(struct Gwn_Batch) * slots);
-	cache->batch_fill = MEM_recallocN(cache->batch_fill, sizeof(struct Gwn_Batch) * slots);
-	cache->batch_edit = MEM_recallocN(cache->batch_edit, sizeof(struct Gwn_Batch) * slots);
-	cache->batch_edlin = MEM_recallocN(cache->batch_edlin, sizeof(struct Gwn_Batch) * slots);
+	cache->batch_stroke = MEM_recallocN(cache->batch_stroke, sizeof(struct Gwn_Batch *) * slots);
+	cache->batch_fill = MEM_recallocN(cache->batch_fill, sizeof(struct Gwn_Batch *) * slots);
+	cache->batch_edit = MEM_recallocN(cache->batch_edit, sizeof(struct Gwn_Batch *) * slots);
+	cache->batch_edlin = MEM_recallocN(cache->batch_edlin, sizeof(struct Gwn_Batch *) * slots);
 }
 
 /* check size and increase if no free slots */
@@ -189,10 +189,10 @@ static void gpencil_batch_cache_init(Object *ob, int cfra)
 	}
 
 	cache->cache_size = GPENCIL_MIN_BATCH_SLOTS_CHUNK;
-	cache->batch_stroke = MEM_callocN(sizeof(struct Gwn_Batch) * cache->cache_size, "Gpencil_Batch_Stroke");
-	cache->batch_fill = MEM_callocN(sizeof(struct Gwn_Batch) * cache->cache_size, "Gpencil_Batch_Fill");
-	cache->batch_edit = MEM_callocN(sizeof(struct Gwn_Batch) * cache->cache_size, "Gpencil_Batch_Edit");
-	cache->batch_edlin = MEM_callocN(sizeof(struct Gwn_Batch) * cache->cache_size, "Gpencil_Batch_Edlin");
+	cache->batch_stroke = MEM_callocN(sizeof(struct Gwn_Batch *) * cache->cache_size, "Gpencil_Batch_Stroke");
+	cache->batch_fill = MEM_callocN(sizeof(struct Gwn_Batch *) * cache->cache_size, "Gpencil_Batch_Fill");
+	cache->batch_edit = MEM_callocN(sizeof(struct Gwn_Batch *) * cache->cache_size, "Gpencil_Batch_Edit");
+	cache->batch_edlin = MEM_callocN(sizeof(struct Gwn_Batch *) * cache->cache_size, "Gpencil_Batch_Edlin");
 
 	cache->is_editmode = GPENCIL_ANY_EDIT_MODE(gpd);
 	gpd->flag &= ~GP_DATA_CACHE_IS_DIRTY;



More information about the Bf-blender-cvs mailing list