Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-07-21 13:01:39 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-07-21 13:01:39 +0400
commit1bb7cfded603028db0d52b3c0917900e83b858e6 (patch)
treef45c25d1f0387172c15c82ccb6432e7a65eb8729 /source/blender/blenkernel/intern/mask.c
parent21e3e3b8fcee68080386b2017951817a8eec5614 (diff)
Merge mask fixes from tomato branch
-- svn merge -r49075:49076 -r49086:49087 ^/branches/soc-2011-tomato
Diffstat (limited to 'source/blender/blenkernel/intern/mask.c')
-rw-r--r--source/blender/blenkernel/intern/mask.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index fa11721a944..f13c27cb436 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -541,6 +541,8 @@ static void spline_feather_collapse_inner_loops(MaskSpline *spline, float (*feat
int next = i + 1;
float delta;
+ DO_MINMAX2(feather_points[i], min, max);
+
if (next == tot_feather_point) {
if (spline->flag & MASK_SPLINE_CYCLIC)
next = 0;
@@ -555,16 +557,27 @@ static void spline_feather_collapse_inner_loops(MaskSpline *spline, float (*feat
delta = fabsf(feather_points[i][1] - feather_points[next][1]);
if (delta > max_delta_y)
max_delta_y = delta;
+ }
- DO_MINMAX2(feather_points[i], min, max);
+ /* prevent divisionsby zero by ensuring bounding box is not collapsed */
+ if (max[0] - min[0] < FLT_EPSILON) {
+ max[0] += 0.01f;
+ min[0] -= 0.01f;
+ }
+
+ if (max[1] - min[1] < FLT_EPSILON) {
+ max[1] += 0.01f;
+ min[1] -= 0.01f;
}
/* use dynamically calculated buckets per side, so we likely wouldn't
* run into a situation when segment doesn't fit two buckets which is
* pain collecting candidates for intersection
*/
+
max_delta_x /= max[0] - min[0];
max_delta_y /= max[1] - min[1];
+
max_delta = MAX2(max_delta_x, max_delta_y);
buckets_per_side = MIN2(512, 0.9f / max_delta);