diff options
author | Jacques Lucke <jacques@blender.org> | 2020-09-09 19:41:07 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-09-09 19:41:07 +0300 |
commit | 63916f5941b443dfc8566682bb75374e5abd553f (patch) | |
tree | fb0704701f1d4d9acbddf4a6fbc62c819d8d4c36 /source/blender/editors/sculpt_paint/paint_stroke.c | |
parent | 0cff2c944f9c2cd3ac873fe826c4399fc2f32159 (diff) |
Cleanup: reduce variable scope
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_stroke.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_stroke.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index e709224f370..db7120ed301 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -711,15 +711,12 @@ static float paint_space_stroke_spacing(bContext *C, static float paint_stroke_overlapped_curve(Brush *br, float x, float spacing) { - int i; const int n = 100 / spacing; const float h = spacing / 50.0f; const float x0 = x - 1; - float sum; - - sum = 0; - for (i = 0; i < n; i++) { + float sum = 0; + for (int i = 0; i < n; i++) { float xx; xx = fabsf(x0 + i * h); @@ -734,21 +731,16 @@ static float paint_stroke_overlapped_curve(Brush *br, float x, float spacing) static float paint_stroke_integrate_overlap(Brush *br, float factor) { - int i; - int m; - float g; - float max; - float spacing = br->spacing * factor; if (!(br->flag & BRUSH_SPACE_ATTEN && (br->spacing < 100))) { return 1.0; } - m = 10; - g = 1.0f / m; - max = 0; - for (i = 0; i < m; i++) { + int m = 10; + float g = 1.0f / m; + float max = 0; + for (int i = 0; i < m; i++) { float overlap = fabs(paint_stroke_overlapped_curve(br, i * g, spacing)); if (overlap > max) { @@ -1151,13 +1143,11 @@ static void paint_stroke_add_sample( static void paint_stroke_sample_average(const PaintStroke *stroke, PaintSample *average) { - int i; - memset(average, 0, sizeof(*average)); BLI_assert(stroke->num_samples > 0); - for (i = 0; i < stroke->num_samples; i++) { + for (int i = 0; i < stroke->num_samples; i++) { add_v2_v2(average->mouse, stroke->samples[i].mouse); average->pressure += stroke->samples[i].pressure; } |