Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-11-09 13:48:55 +0300
committerJacques Lucke <jacques@blender.org>2020-11-09 13:48:55 +0300
commit29693c7b070a05ffe8789ecdce34852fd0e31ecf (patch)
tree790cf9ea465f8ae531de4c4c78250c125314210e /source/blender/editors/sculpt_paint/paint_mask.c
parent71ff935fd6bb8d4aa5b93790cbde0af71be11497 (diff)
Sculpt: Fix off-by-one error when creating bitmap for lasso gesture
Reviewers: pablodp606 Differential Revision: https://developer.blender.org/D9472
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_mask.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index 29e06eee586..cde24cd2c25 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -384,10 +384,10 @@ static SculptGestureContext *sculpt_gesture_init_from_lasso(bContext *C, wmOpera
ED_view3d_ob_project_mat_get(
sgcontext->vc.rv3d, sgcontext->vc.obact, sgcontext->lasso.projviewobjmat);
BLI_lasso_boundbox(&sgcontext->lasso.boundbox, mcoords, mcoords_len);
- sgcontext->lasso.width = sgcontext->lasso.boundbox.xmax - sgcontext->lasso.boundbox.xmin;
- sgcontext->lasso.mask_px = BLI_BITMAP_NEW(
- sgcontext->lasso.width * (sgcontext->lasso.boundbox.ymax - sgcontext->lasso.boundbox.ymin),
- __func__);
+ const int lasso_width = 1 + sgcontext->lasso.boundbox.xmax - sgcontext->lasso.boundbox.xmin;
+ const int lasso_height = 1 + sgcontext->lasso.boundbox.ymax - sgcontext->lasso.boundbox.ymin;
+ sgcontext->lasso.width = lasso_width;
+ sgcontext->lasso.mask_px = BLI_BITMAP_NEW(lasso_width * lasso_height, __func__);
BLI_bitmap_draw_2d_poly_v2i_n(sgcontext->lasso.boundbox.xmin,
sgcontext->lasso.boundbox.ymin,