[Bf-blender-cvs] [8ce14aa21f4] master: Cleanup: rename image undo_tile to paint_tile

Campbell Barton noreply at git.blender.org
Tue Oct 1 18:05:21 CEST 2019


Commit: 8ce14aa21f45653ab33bdd9e6e20cea3f09fa873
Author: Campbell Barton
Date:   Wed Oct 2 01:54:58 2019 +1000
Branches: master
https://developer.blender.org/rB8ce14aa21f45653ab33bdd9e6e20cea3f09fa873

Cleanup: rename image undo_tile to paint_tile

Clearer because they're no longer the same as undo tiles.

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

M	source/blender/editors/include/ED_paint.h
M	source/blender/editors/sculpt_paint/paint_image.c
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 82f5e3b2b57..84f63a5e54b 100644
--- a/source/blender/editors/include/ED_paint.h
+++ b/source/blender/editors/include/ED_paint.h
@@ -51,32 +51,33 @@ void ED_image_undo_restore(struct UndoStep *us);
 
 void ED_image_undosys_type(struct UndoType *ut);
 
-void *image_undo_find_tile(struct ListBase *undo_tiles,
-                           struct Image *ima,
-                           struct ImBuf *ibuf,
-                           int x_tile,
-                           int y_tile,
-                           unsigned short **mask,
-                           bool validate);
-void *image_undo_push_tile(struct ListBase *undo_tiles,
-                           struct Image *ima,
-                           struct ImBuf *ibuf,
-                           struct ImBuf **tmpibuf,
-                           int x_tile,
-                           int y_tile,
-                           unsigned short **,
-                           bool **valid,
-                           bool proj,
-                           bool find_prev);
-void image_undo_remove_masks(void);
-void image_undo_init_locks(void);
-void image_undo_end_locks(void);
+void *ED_image_paint_tile_find(struct ListBase *undo_tiles,
+                               struct Image *ima,
+                               struct ImBuf *ibuf,
+                               int x_tile,
+                               int y_tile,
+                               unsigned short **r_mask,
+                               bool validate);
+void *ED_image_paint_tile_push(struct ListBase *undo_tiles,
+                               struct Image *ima,
+                               struct ImBuf *ibuf,
+                               struct ImBuf **tmpibuf,
+                               int x_tile,
+                               int y_tile,
+                               unsigned short **r_mask,
+                               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);
 
-struct ListBase *ED_image_undo_get_tiles(void);
+struct ListBase *ED_image_paint_tile_list_get(void);
 
-#define IMAPAINT_TILE_BITS 6
-#define IMAPAINT_TILE_SIZE (1 << IMAPAINT_TILE_BITS)
-#define IMAPAINT_TILE_NUMBER(size) (((size) + IMAPAINT_TILE_SIZE - 1) >> IMAPAINT_TILE_BITS)
+#define ED_IMAGE_UNDO_TILE_BITS 6
+#define ED_IMAGE_UNDO_TILE_SIZE (1 << ED_IMAGE_UNDO_TILE_BITS)
+#define ED_IMAGE_UNDO_TILE_NUMBER(size) \
+  (((size) + ED_IMAGE_UNDO_TILE_SIZE - 1) >> ED_IMAGE_UNDO_TILE_BITS)
 
 /* paint_curve_undo.c */
 void ED_paintcurve_undo_push_begin(const char *name);
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 54531139616..24c2dfb6c6b 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -113,10 +113,10 @@ void imapaint_region_tiles(
 
   IMB_rectclip(ibuf, NULL, &x, &y, &srcx, &srcy, &w, &h);
 
-  *tw = ((x + w - 1) >> IMAPAINT_TILE_BITS);
-  *th = ((y + h - 1) >> IMAPAINT_TILE_BITS);
-  *tx = (x >> IMAPAINT_TILE_BITS);
-  *ty = (y >> IMAPAINT_TILE_BITS);
+  *tw = ((x + w - 1) >> ED_IMAGE_UNDO_TILE_BITS);
+  *th = ((y + h - 1) >> ED_IMAGE_UNDO_TILE_BITS);
+  *tx = (x >> ED_IMAGE_UNDO_TILE_BITS);
+  *ty = (y >> ED_IMAGE_UNDO_TILE_BITS);
 }
 
 void ED_imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w, int h, bool find_old)
@@ -147,11 +147,12 @@ void ED_imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w, int
 
   imapaint_region_tiles(ibuf, x, y, w, h, &tilex, &tiley, &tilew, &tileh);
 
-  ListBase *undo_tiles = ED_image_undo_get_tiles();
+  ListBase *undo_tiles = ED_image_paint_tile_list_get();
 
   for (ty = tiley; ty <= tileh; ty++) {
     for (tx = tilex; tx <= tilew; tx++) {
-      image_undo_push_tile(undo_tiles, ima, ibuf, &tmpibuf, tx, ty, NULL, NULL, false, find_old);
+      ED_image_paint_tile_push(
+          undo_tiles, ima, ibuf, &tmpibuf, tx, ty, NULL, NULL, false, find_old);
     }
   }
 
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 8f1156295a3..58ea00d6740 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -1197,23 +1197,24 @@ static void paint_2d_do_making_brush(ImagePaintState *s,
                                      int tileh)
 {
   ImBuf tmpbuf;
-  IMB_initImBuf(&tmpbuf, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, 0);
+  IMB_initImBuf(&tmpbuf, ED_IMAGE_UNDO_TILE_SIZE, ED_IMAGE_UNDO_TILE_SIZE, 32, 0);
 
-  ListBase *undo_tiles = ED_image_undo_get_tiles();
+  ListBase *undo_tiles = ED_image_paint_tile_list_get();
 
   for (int ty = tiley; ty <= tileh; ty++) {
     for (int tx = tilex; tx <= tilew; tx++) {
       /* retrieve original pixels + mask from undo buffer */
       unsigned short *mask;
-      int origx = region->destx - tx * IMAPAINT_TILE_SIZE;
-      int origy = region->desty - ty * IMAPAINT_TILE_SIZE;
+      int origx = region->destx - tx * ED_IMAGE_UNDO_TILE_SIZE;
+      int origy = region->desty - ty * ED_IMAGE_UNDO_TILE_SIZE;
 
       if (s->canvas->rect_float) {
-        tmpbuf.rect_float = image_undo_find_tile(
+        tmpbuf.rect_float = ED_image_paint_tile_find(
             undo_tiles, s->image, s->canvas, tx, ty, &mask, false);
       }
       else {
-        tmpbuf.rect = image_undo_find_tile(undo_tiles, s->image, s->canvas, tx, ty, &mask, false);
+        tmpbuf.rect = ED_image_paint_tile_find(
+            undo_tiles, s->image, s->canvas, tx, ty, &mask, false);
       }
 
       IMB_rectblend(s->canvas,
@@ -1455,7 +1456,7 @@ static void paint_2d_canvas_free(ImagePaintState *s)
     MEM_freeN(s->blurkernel);
   }
 
-  image_undo_remove_masks();
+  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 4ec3d4ec70b..756374fab96 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -1807,31 +1807,31 @@ static int project_paint_undo_subtiles(const TileInfo *tinf, int tx, int ty)
   }
 
   if (generate_tile) {
-    ListBase *undo_tiles = ED_image_undo_get_tiles();
+    ListBase *undo_tiles = ED_image_paint_tile_list_get();
     volatile void *undorect;
     if (tinf->masked) {
-      undorect = image_undo_push_tile(undo_tiles,
-                                      pjIma->ima,
-                                      pjIma->ibuf,
-                                      tinf->tmpibuf,
-                                      tx,
-                                      ty,
-                                      &pjIma->maskRect[tile_index],
-                                      &pjIma->valid[tile_index],
-                                      true,
-                                      false);
+      undorect = ED_image_paint_tile_push(undo_tiles,
+                                          pjIma->ima,
+                                          pjIma->ibuf,
+                                          tinf->tmpibuf,
+                                          tx,
+                                          ty,
+                                          &pjIma->maskRect[tile_index],
+                                          &pjIma->valid[tile_index],
+                                          true,
+                                          false);
     }
     else {
-      undorect = image_undo_push_tile(undo_tiles,
-                                      pjIma->ima,
-                                      pjIma->ibuf,
-                                      tinf->tmpibuf,
-                                      tx,
-                                      ty,
-                                      NULL,
-                                      &pjIma->valid[tile_index],
-                                      true,
-                                      false);
+      undorect = ED_image_paint_tile_push(undo_tiles,
+                                          pjIma->ima,
+                                          pjIma->ibuf,
+                                          tinf->tmpibuf,
+                                          tx,
+                                          ty,
+                                          NULL,
+                                          &pjIma->valid[tile_index],
+                                          true,
+                                          false);
     }
 
     BKE_image_mark_dirty(pjIma->ima, pjIma->ibuf);
@@ -1880,14 +1880,14 @@ static ProjPixel *project_paint_uvpixel_init(const ProjPaintState *ps,
 
   /* calculate the undo tile offset of the pixel, used to store the original
    * pixel color and accumulated mask if any */
-  x_tile = x_px >> IMAPAINT_TILE_BITS;
-  y_tile = y_px >> IMAPAINT_TILE_BITS;
+  x_tile = x_px >> ED_IMAGE_UNDO_TILE_BITS;
+  y_tile = y_px >> ED_IMAGE_UNDO_TILE_BITS;
 
-  x_round = x_tile * IMAPAINT_TILE_SIZE;
-  y_round = y_tile * IMAPAINT_TILE_SIZE;
+  x_round = x_tile * ED_IMAGE_UNDO_TILE_SIZE;
+  y_round = y_tile * ED_IMAGE_UNDO_TILE_SIZE;
   // memset(projPixel, 0, size);
 
-  tile_offset = (x_px - x_round) + (y_px - y_round) * IMAPAINT_TILE_SIZE;
+  tile_offset = (x_px - x_round) + (y_px - y_round) * ED_IMAGE_UNDO_TILE_SIZE;
   tile_index = project_paint_undo_subtiles(tinf, x_tile, y_tile);
 
   /* other thread may be initializing the tile so wait here */
@@ -1895,8 +1895,9 @@ static ProjPixel *project_paint_uvpixel_init(const ProjPaintState *ps,
     /* pass */
   }
 
-  BLI_assert(tile_index < (IMAPAINT_TILE_NUMBER(ibuf->x) * IMAPAINT_TILE_NUMBER(ibuf->y)));
-  BLI_assert(tile_offset < (IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE));
+  BLI_assert(tile_index <
+             (ED_IMAGE_UNDO_TILE_NUMBER(ibuf->x) * ED_IMAGE_UNDO_TILE_NUMBER(ibuf->y)));
+  BLI_assert(tile_offset < (ED_IMAG

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list