Commit: 259d47a15e752250f34e98c438bf41aa31441cf8
Author: Nicholas Bishop
Date:   Wed Feb 11 13:33:47 2015 +0100
Branches: master
https://developer.blender.org/rB259d47a15e752250f34e98c438bf41aa31441cf8

Minor code cleanup: move some duplicated texpaint code into function

Reviewers: psy-fi

Reviewed By: psy-fi

Differential Revision: https://developer.blender.org/D1098

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

M       source/blender/editors/sculpt_paint/paint_image_proj.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c 
b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 439e9cd..6d4a04e 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -4343,6 +4343,15 @@ static void do_projectpaint_mask_f(ProjPaintState *ps, 
ProjPixel *projPixel, flo
        }
 }
 
+static void image_paint_partial_redraw_expand(ImagePaintPartialRedraw *cell,
+                                                                               
          const ProjPixel *projPixel)
+{
+       cell->x1 = min_ii(cell->x1, (int)projPixel->x_px);
+       cell->y1 = min_ii(cell->y1, (int)projPixel->y_px);
+
+       cell->x2 = max_ii(cell->x2, (int)projPixel->x_px + 1);
+       cell->y2 = max_ii(cell->y2, (int)projPixel->y_px + 1);
+}
 
 /* run this for single and multithreaded painting */
 static void *do_projectpaint_thread(void *ph_v)
@@ -4496,11 +4505,7 @@ static void *do_projectpaint_thread(void *ph_v)
                                        }
 
                                        last_partial_redraw_cell = 
last_projIma->partRedrawRect + projPixel->bb_cell_index;
-                                       last_partial_redraw_cell->x1 = 
min_ii(last_partial_redraw_cell->x1, (int)projPixel->x_px);
-                                       last_partial_redraw_cell->y1 = 
min_ii(last_partial_redraw_cell->y1, (int)projPixel->y_px);
-
-                                       last_partial_redraw_cell->x2 = 
max_ii(last_partial_redraw_cell->x2, (int)projPixel->x_px + 1);
-                                       last_partial_redraw_cell->y2 = 
max_ii(last_partial_redraw_cell->y2, (int)projPixel->y_px + 1);
+                                       
image_paint_partial_redraw_expand(last_partial_redraw_cell, projPixel);
                                }
                                else {
                                        if (is_floatbuf) {
@@ -4634,11 +4639,7 @@ static void *do_projectpaint_thread(void *ph_v)
                                                        *projPixel->valid = 
true;
 
                                                        
last_partial_redraw_cell = last_projIma->partRedrawRect + 
projPixel->bb_cell_index;
-                                                       
last_partial_redraw_cell->x1 = min_ii(last_partial_redraw_cell->x1, 
(int)projPixel->x_px);
-                                                       
last_partial_redraw_cell->y1 = min_ii(last_partial_redraw_cell->y1, 
(int)projPixel->y_px);
-
-                                                       
last_partial_redraw_cell->x2 = max_ii(last_partial_redraw_cell->x2, 
(int)projPixel->x_px + 1);
-                                                       
last_partial_redraw_cell->y2 = max_ii(last_partial_redraw_cell->y2, 
(int)projPixel->y_px + 1);
+                                                       
image_paint_partial_redraw_expand(last_partial_redraw_cell, projPixel);
 
                                                        /* texrgb is not used 
for clone, smear or soften */
                                                        switch (tool) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to