diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_image_proj.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_proj.c | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index db3e69b0953..7df5848e068 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -4134,8 +4134,9 @@ static bool project_paint_clone_face_skip(ProjPaintState *ps, if (ps->do_material_slots) { if (lc->slot_clone != lc->slot_last_clone) { - if (!slot->uvname || !(lc->mloopuv_clone_base = CustomData_get_layer_named( - &ps->me_eval->ldata, CD_MLOOPUV, lc->slot_clone->uvname))) { + if (!lc->slot_clone->uvname || + !(lc->mloopuv_clone_base = CustomData_get_layer_named( + &ps->me_eval->ldata, CD_MLOOPUV, lc->slot_clone->uvname))) { lc->mloopuv_clone_base = CustomData_get_layer(&ps->me_eval->ldata, CD_MLOOPUV); } lc->slot_last_clone = lc->slot_clone; @@ -4648,13 +4649,7 @@ static void project_paint_end(ProjPaintState *ps) /* 1 = an undo, -1 is a redo. */ static void partial_redraw_single_init(ImagePaintPartialRedraw *pr) { - pr->x1 = INT_MAX; - pr->y1 = INT_MAX; - - pr->x2 = -1; - pr->y2 = -1; - - pr->enabled = 1; + BLI_rcti_init_minmax(&pr->dirty_region); } static void partial_redraw_array_init(ImagePaintPartialRedraw *pr) @@ -4670,16 +4665,11 @@ static bool partial_redraw_array_merge(ImagePaintPartialRedraw *pr, ImagePaintPartialRedraw *pr_other, int tot) { - bool touch = 0; + bool touch = false; while (tot--) { - pr->x1 = min_ii(pr->x1, pr_other->x1); - pr->y1 = min_ii(pr->y1, pr_other->y1); - - pr->x2 = max_ii(pr->x2, pr_other->x2); - pr->y2 = max_ii(pr->y2, pr_other->y2); - - if (pr->x2 != -1) { - touch = 1; + BLI_rcti_do_minmax_rcti(&pr->dirty_region, &pr_other->dirty_region); + if (!BLI_rcti_is_empty(&pr->dirty_region)) { + touch = true; } pr++; @@ -4702,7 +4692,7 @@ static bool project_image_refresh_tagged(ProjPaintState *ps) /* look over each bound cell */ for (i = 0; i < PROJ_BOUNDBOX_SQUARED; i++) { pr = &(projIma->partRedrawRect[i]); - if (pr->x2 != -1) { /* TODO: use 'enabled' ? */ + if (BLI_rcti_is_valid(&pr->dirty_region)) { set_imapaintpartial(pr); imapaint_image_update(NULL, projIma->ima, projIma->ibuf, &projIma->iuser, true); redraw = 1; @@ -5116,11 +5106,10 @@ static void do_projectpaint_mask_f(ProjPaintState *ps, ProjPixel *projPixel, flo static void image_paint_partial_redraw_expand(ImagePaintPartialRedraw *cell, const ProjPixel *projPixel) { - cell->x1 = min_ii(cell->x1, (int)projPixel->x_px); - cell->y1 = min_ii(cell->y1, (int)projPixel->y_px); - - cell->x2 = max_ii(cell->x2, (int)projPixel->x_px + 1); - cell->y2 = max_ii(cell->y2, (int)projPixel->y_px + 1); + rcti rect_to_add; + BLI_rcti_init( + &rect_to_add, projPixel->x_px, projPixel->x_px + 1, projPixel->y_px, projPixel->y_px + 1); + BLI_rcti_do_minmax_rcti(&cell->dirty_region, &rect_to_add); } static void copy_original_alpha_channel(ProjPixel *pixel, bool is_floatbuf) @@ -6335,8 +6324,6 @@ void ED_paint_data_warning(struct ReportList *reports, bool uvs, bool mat, bool !stencil ? " Stencil," : ""); } -/* Make sure that active object has a material, - * and assign UVs and image layers if they do not exist */ bool ED_paint_proj_mesh_data_check( Scene *scene, Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil) { |