Commit: 482a0c2bfc9e9f68f5785ae3278a8ccbeaac0541
Author: Campbell Barton
Date:   Mon Jul 14 12:15:47 2014 +1000
https://developer.blender.org/rB482a0c2bfc9e9f68f5785ae3278a8ccbeaac0541

Minor edits, no point to using `short` for pixel coords

Was doing short/int/float conversion.
Also initialize on use

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

M       source/blender/editors/sculpt_paint/paint_image_2d.c
M       source/blender/editors/sculpt_paint/paint_intern.h

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

diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c 
b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 878e1d5..1392620 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -1348,7 +1348,10 @@ static void paint_2d_fill_add_pixel_float(
 }
 
 /* this function expects linear space color values */
-void paint_2d_bucket_fill(const bContext *C, const float color[3], Brush *br, 
float mouse_init[2], void *ps)
+void paint_2d_bucket_fill(
+        const bContext *C, const float color[3], Brush *br,
+        const float mouse_init[2],
+        void *ps)
 {
        SpaceImage *sima = CTX_wm_space_image(C);
        Image *ima = sima->image;
@@ -1356,7 +1359,7 @@ void paint_2d_bucket_fill(const bContext *C, const float 
color[3], Brush *br, fl
        ImagePaintState *s = ps;
 
        ImBuf *ibuf;
-       int i = 0, j = 0;
+       int i, j;
        unsigned int color_b;
        float color_f[4];
        float strength = br ? br->alpha : 1.0f;
@@ -1521,14 +1524,17 @@ void paint_2d_bucket_fill(const bContext *C, const 
float color[3], Brush *br, fl
        WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
 }
 
-void paint_2d_gradient_fill (const bContext *C, Brush *br, float 
mouse_init[2], float mouse_final[2], void *ps)
+void paint_2d_gradient_fill(
+        const bContext *C, Brush *br,
+        const float mouse_init[2], const float mouse_final[2],
+        void *ps)
 {
        SpaceImage *sima = CTX_wm_space_image(C);
        Image *ima = sima->image;
        ImagePaintState *s = ps;
 
        ImBuf *ibuf;
-       unsigned short i = 0, j = 0;
+       int i, j;
        unsigned int color_b;
        float color_f[4];
        float image_init[2], image_final[2];
@@ -1566,7 +1572,7 @@ void paint_2d_gradient_fill (const bContext *C, Brush 
*br, float mouse_init[2],
        ED_imapaint_dirty_region(ima, ibuf, 0, 0, ibuf->x, ibuf->y);
 
        if (do_float) {
-               for (; i < ibuf->x; i++) {
+               for (i = 0; i < ibuf->x; i++) {
                        for (j = 0; j < ibuf->y; j++) {
                                float f;
                                float p[2] = {i - image_init[0], j - 
image_init[1]};
@@ -1594,7 +1600,7 @@ void paint_2d_gradient_fill (const bContext *C, Brush 
*br, float mouse_init[2],
                }
        }
        else {
-               for (; i < ibuf->x; i++) {
+               for (i = 0; i < ibuf->x; i++) {
                        for (j = 0; j < ibuf->y; j++) {
                                float f;
                                float p[2] = {i - image_init[0], j - 
image_init[1]};
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h 
b/source/blender/editors/sculpt_paint/paint_intern.h
index 836a262..40e03bd 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -162,8 +162,8 @@ void *paint_2d_new_stroke(struct bContext *, struct 
wmOperator *, int mode);
 void paint_2d_redraw(const bContext *C, void *ps, bool final);
 void paint_2d_stroke_done(void *ps);
 void paint_2d_stroke(void *ps, const float prev_mval[2], const float mval[2], 
int eraser, float pressure, float distance, float size);
-void paint_2d_bucket_fill(const struct bContext *C, const float color[3], 
struct Brush *br, float mouse_init[], void *ps);
-void paint_2d_gradient_fill (const struct bContext *C, struct Brush *br, float 
mouse_init[2], float mouse_final[2], void *ps);
+void paint_2d_bucket_fill(const struct bContext *C, const float color[3], 
struct Brush *br, const float mouse_init[2], void *ps);
+void paint_2d_gradient_fill (const struct bContext *C, struct Brush *br, const 
float mouse_init[2], const float mouse_final[2], void *ps);
 void *paint_proj_new_stroke(struct bContext *C, struct Object *ob, const float 
mouse[2], int mode);
 void paint_proj_stroke(const struct bContext *C, void *ps, const float 
prevmval_i[2], const float mval_i[2], float pressure, float distance, float 
size);
 void paint_proj_redraw(const struct bContext *C, void *pps, bool final);

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

Reply via email to