clamp mask resolution, the occasional crash would happen failing to alloc when adding feather points very close together.

This commit is contained in:
2012-07-27 11:05:08 +00:00
parent 915fdd67df
commit 9a2d862123
2 changed files with 14 additions and 0 deletions

View File

@@ -214,6 +214,8 @@ void BKE_mask_init_layers(Mask *mask, struct layer_init_data *mlayer_data, int w
#define MASKPOINT_SEL_HANDLE(p) { (p)->bezt.f1 |= SELECT; (p)->bezt.f3 |= SELECT; } (void)0
#define MASKPOINT_DESEL_HANDLE(p) { (p)->bezt.f1 &= ~SELECT; (p)->bezt.f3 &= ~SELECT; } (void)0
#define MASK_RESOL_MAX 128
/* disable to test alternate rasterizer */
/* #define USE_RASKTER */

View File

@@ -301,6 +301,12 @@ int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height)
resol = MAX2(resol, cur_resol);
}
BLI_assert(resol > 0);
if (resol > MASK_RESOL_MAX) {
resol = MASK_RESOL_MAX;
}
return resol;
}
@@ -331,6 +337,12 @@ int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int height
resol += max_jump / max_segment;
BLI_assert(resol > 0);
if (resol > MASK_RESOL_MAX) {
resol = MASK_RESOL_MAX;
}
return resol;
}