Cleanup: remove ED_image_paint_tile_remove_masks_all
authorCampbell Barton <ideasman42@gmail.com>
Tue, 1 Oct 2019 16:08:20 +0000 (02:08 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 1 Oct 2019 16:13:50 +0000 (02:13 +1000)
Masks are now temporary, not part of the persistent undo tiles.
Now they're always freed after the stroke.

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

index 84f63a5e54ba1c24f31c93797c566f8432883d2a..fec4beea809c6ae70762dd8052fcb67049347852 100644 (file)
@@ -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);
 
index 58ea00d67408eac2da4ba21f5ddc9e8d0093c1a1..4f1ae10aa6246abe44da536c197ea0c8aecaed4a 100644 (file)
@@ -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,
index 756374fab961aeea5ef50cf28385ca35c0df1e2c..5e004c7d6753bbf03a494410c7bd8b27d591022e 100644 (file)
@@ -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;
index 4ac621d34ff29ded0ebcbddc2ae16e2716efae6e..c450d5122ebc44ee16741603cb16af9c9b2430dc 100644 (file)
@@ -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,