use calculated spline resoltion rather then fixed at 32.

This commit is contained in:
Campbell Barton 2012-07-16 14:17:01 +00:00
parent 5b4a455569
commit f9e63430ac
3 changed files with 9 additions and 3 deletions

View File

@ -64,6 +64,9 @@ void BKE_mask_layer_copy_list(struct ListBase *masklayers_new, struct ListBase *
/* splines */
struct MaskSpline *BKE_mask_spline_add(struct MaskLayer *masklay);
int BKE_mask_spline_resolution(struct MaskSpline *spline, int width, int height);
int BKE_mask_spline_feather_resolution(struct MaskSpline *spline, int width, int height);
int BKE_mask_spline_differentiate_calc_total(const struct MaskSpline *spline, const int resol);
float (*BKE_mask_spline_differentiate(struct MaskSpline *spline, int *tot_diff_point))[2];

View File

@ -246,7 +246,7 @@ MaskSpline *BKE_mask_spline_add(MaskLayer *masklay)
return spline;
}
static int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height)
int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height)
{
float max_segment = 0.01f;
int i, resol = 1;
@ -284,7 +284,7 @@ static int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height)
return resol;
}
static int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int height)
int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int height)
{
const float max_segment = 0.005;
int resol = BKE_mask_spline_resolution(spline, width, height);

View File

@ -471,7 +471,6 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
const short do_feather)
{
const rctf default_bounds = {0.0f, 1.0f, 0.0f, 1.0f};
const int resol = SPLINE_RESOL; /* TODO: real size */
const float pixel_size = 1.0f / MIN2(width, height);
const float zvec[3] = {0.0f, 0.0f, 1.0f};
@ -522,6 +521,10 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
float (*diff_feather_points)[2];
int tot_diff_feather_points;
const int resol_a = BKE_mask_spline_resolution(spline, width, height) / 4;
const int resol_b = BKE_mask_spline_feather_resolution(spline, width, height) / 4;
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);