[Bf-blender-cvs] [a513586cd23] master: Cleanup: remove ED_image_paint_tile_remove_masks_all

Campbell Barton noreply at git.blender.org
Tue Oct 1 18:15:09 CEST 2019


Commit: a513586cd23e14c79f23fe14297bdca78019ec14
Author: Campbell Barton
Date:   Wed Oct 2 02:08:20 2019 +1000
Branches: master
https://developer.blender.org/rBa513586cd23e14c79f23fe14297bdca78019ec14

Cleanup: remove ED_image_paint_tile_remove_masks_all

Masks are now temporary, not part of the persistent undo tiles.
Now they're always freed after the stroke.

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

M	source/blender/editors/include/ED_paint.h
M	source/blender/editors/sculpt_paint/paint_image_2d.c
M	source/blender/editors/sculpt_paint/paint_image_proj.c
M	source/blender/editors/space_image/image_undo.c

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

diff --git a/source/blender/editors/include/ED_paint.h b/source/blender/editors/include/ED_paint.h
index 84f63a5e54b..fec4beea809 100644
--- a/source/blender/editors/include/ED_paint.h
+++ b/source/blender/editors/include/ED_paint.h
@@ -68,7 +68,6 @@ void *ED_image_paint_tile_push(struct ListBase *undo_tiles,
                                bool **r_valid,
                                bool use_thread_lock,
                                bool find_prev);
-void ED_image_paint_tile_remove_masks_all(void);
 void ED_image_paint_tile_lock_init(void);
 void ED_image_paint_tile_lock_end(void);
 
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 58ea00d6740..4f1ae10aa62 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -1455,8 +1455,6 @@ static void paint_2d_canvas_free(ImagePaintState *s)
     paint_delete_blur_kernel(s->blurkernel);
     MEM_freeN(s->blurkernel);
   }
-
-  ED_image_paint_tile_remove_masks_all();
 }
 
 void paint_2d_stroke(void *ps,
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 756374fab96..5e004c7d675 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -4536,8 +4536,6 @@ static void project_paint_end(ProjPaintState *ps)
 {
   int a;
 
-  ED_image_paint_tile_remove_masks_all();
-
   /* dereference used image buffers */
   if (ps->is_shared_user == false) {
     ProjPaintImage *projIma;
diff --git a/source/blender/editors/space_image/image_undo.c b/source/blender/editors/space_image/image_undo.c
index 4ac621d34ff..c450d5122eb 100644
--- a/source/blender/editors/space_image/image_undo.c
+++ b/source/blender/editors/space_image/image_undo.c
@@ -123,6 +123,9 @@ static void ptile_free(PaintTile *ptile)
   if (ptile->rect.pt) {
     MEM_freeN(ptile->rect.pt);
   }
+  if (ptile->mask) {
+    MEM_freeN(ptile->mask);
+  }
   MEM_freeN(ptile);
 }
 
@@ -171,14 +174,6 @@ void *ED_image_paint_tile_find(ListBase *paint_tiles,
   return NULL;
 }
 
-void ED_image_paint_tile_remove_masks_all(void)
-{
-  ListBase *paint_tiles = ED_image_paint_tile_list_get();
-  for (PaintTile *ptile = paint_tiles->first; ptile; ptile = ptile->next) {
-    MEM_SAFE_FREE(ptile->mask);
-  }
-}
-
 void *ED_image_paint_tile_push(ListBase *paint_tiles,
                                Image *image,
                                ImBuf *ibuf,



More information about the Bf-blender-cvs mailing list