diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-02-28 12:57:12 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-02-28 12:57:12 +0300 |
commit | 6f23401e984ee5bad621109ff78eeb6850044fee (patch) | |
tree | df97bd27dda77bb77884b25fa8c320e8030e04f7 /source/blender/editors/sculpt_paint | |
parent | 307d612404caa1ed3252d568b506353e07242296 (diff) | |
parent | 6bbf63f25195d97c2770470a973bafb35dda5e28 (diff) |
Merge branch 'blender-v3.1-release'
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc b/source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc index 64115f7c6eb..f5657b004e2 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc +++ b/source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc @@ -53,6 +53,7 @@ static void update_curve_mask(CurveMaskCache *curve_mask_cache, { BLI_assert(curve_mask_cache->curve_mask != nullptr); int offset = (int)floorf(diameter / 2.0f); + int clamped_radius = max_ff(radius, 1.0); unsigned short *m = curve_mask_cache->curve_mask; @@ -76,7 +77,7 @@ static void update_curve_mask(CurveMaskCache *curve_mask_cache, pixel_xy[1] = static_cast<float>(y) + aa_offset; for (int j = 0; j < aa_samples; j++) { const float len = len_v2v2(pixel_xy, bpos); - const int sample_index = min_ii((len / radius) * CurveSamplesBaseLen, + const int sample_index = min_ii((len / clamped_radius) * CurveSamplesBaseLen, CurveSamplesLen - 1); const float sample_weight = curve_mask_cache->sampled_curve[sample_index]; |