[Bf-blender-cvs] [29693c7b070] blender-v2.91-release: Sculpt: Fix off-by-one error when creating bitmap for lasso gesture

Jacques Lucke noreply at git.blender.org
Mon Nov 9 11:49:12 CET 2020


Commit: 29693c7b070a05ffe8789ecdce34852fd0e31ecf
Author: Jacques Lucke
Date:   Mon Nov 9 11:48:55 2020 +0100
Branches: blender-v2.91-release
https://developer.blender.org/rB29693c7b070a05ffe8789ecdce34852fd0e31ecf

Sculpt: Fix off-by-one error when creating bitmap for lasso gesture

Reviewers: pablodp606

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

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

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

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

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,



More information about the Bf-blender-cvs mailing list