diff options
-rw-r--r-- | source/blender/blenkernel/BKE_mask.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mask.c | 25 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mask_rasterize.c | 4 |
3 files changed, 23 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index a293e4a784b..9a4f30c853f 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -72,9 +72,11 @@ int BKE_mask_spline_differentiate_calc_total(const struct MaskSpline *spline, co float (*BKE_mask_spline_differentiate(struct MaskSpline *spline, int *tot_diff_point))[2]; float (*BKE_mask_spline_feather_differentiated_points(struct MaskSpline *spline, int *tot_feather_point))[2]; -float (*BKE_mask_spline_differentiate_with_resolution_ex(struct MaskSpline *spline, const int resol, int *tot_diff_point))[2]; +float (*BKE_mask_spline_differentiate_with_resolution_ex(struct MaskSpline *spline, int *tot_diff_point, + const int resol))[2]; float (*BKE_mask_spline_differentiate_with_resolution(struct MaskSpline *spline, int width, int height, int *tot_diff_point))[2]; -float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(struct MaskSpline *spline, const int resol, int *tot_feather_point))[2]; +float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(struct MaskSpline *spline, int *tot_feather_point, + const int resol, const int do_collapse))[2]; float (*BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline, int width, int height, int *tot_feather_point))[2]; float (*BKE_mask_spline_feather_points(struct MaskSpline *spline, int *tot_feather_point))[2]; diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 7eb06a1b9ca..4b2f4947a71 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -331,8 +331,10 @@ int BKE_mask_spline_differentiate_calc_total(const MaskSpline *spline, const int return len; } -float (*BKE_mask_spline_differentiate_with_resolution_ex(MaskSpline *spline, const int resol, - int *tot_diff_point))[2] +float (*BKE_mask_spline_differentiate_with_resolution_ex(MaskSpline *spline, + int *tot_diff_point, + const int resol + ))[2] { MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); @@ -389,11 +391,12 @@ float (*BKE_mask_spline_differentiate_with_resolution_ex(MaskSpline *spline, con } float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, int width, int height, - int *tot_diff_point))[2] + int *tot_diff_point + ))[2] { int resol = BKE_mask_spline_resolution(spline, width, height); - return BKE_mask_spline_differentiate_with_resolution_ex(spline, resol, tot_diff_point); + return BKE_mask_spline_differentiate_with_resolution_ex(spline, tot_diff_point, resol); } float (*BKE_mask_spline_differentiate(MaskSpline *spline, int *tot_diff_point))[2] @@ -562,8 +565,11 @@ static void spline_feather_collapse_inner_loops(float (*feather_points)[2], int * values align with #BKE_mask_spline_differentiate_with_resolution_ex * when \a resol arguments match. */ -float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(MaskSpline *spline, const int resol, - int *tot_feather_point))[2] +float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(MaskSpline *spline, + int *tot_feather_point, + const int resol, + const int do_collapse + ))[2] { MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); MaskSplinePoint *point, *prev; @@ -624,7 +630,10 @@ float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(MaskSpl *tot_feather_point = tot; - spline_feather_collapse_inner_loops(feather, tot); + /* this is slow! - don't do on draw */ + if (do_collapse) { + spline_feather_collapse_inner_loops(feather, tot); + } return feather; } @@ -634,7 +643,7 @@ float (*BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline { int resol = BKE_mask_spline_feather_resolution(spline, width, height); - return BKE_mask_spline_feather_differentiated_points_with_resolution_ex(spline, resol, tot_feather_point); + return BKE_mask_spline_feather_differentiated_points_with_resolution_ex(spline, tot_feather_point, resol, FALSE); } float (*BKE_mask_spline_feather_differentiated_points(MaskSpline *spline, int *tot_feather_point))[2] diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index a4fd5c3509b..69bc092a613 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -525,11 +525,11 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas const int resol = CLAMPIS(MAX2(resol_a, resol_b), 4, 512); diff_points = BKE_mask_spline_differentiate_with_resolution_ex( - spline, resol, &tot_diff_point); + spline, &tot_diff_point, resol); if (do_feather) { diff_feather_points = BKE_mask_spline_feather_differentiated_points_with_resolution_ex( - spline, resol, &tot_diff_feather_points); + spline, &tot_diff_feather_points, resol, TRUE); } else { tot_diff_feather_points = 0; |