[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49087] branches/soc-2011-tomato/source/ blender/blenkernel/intern/mask.c: Masking: prevent crashes in cases when mask spline is axis aligned
Sergey Sharybin
sergey.vfx at gmail.com
Fri Jul 20 19:31:04 CEST 2012
Woops. Commited form a computer used by Lukas in Blender Institute. Pardon
for that,
that was actually mine commit.
On Fri, Jul 20, 2012 at 7:28 PM, Lukas Toenne
<lukas.toenne at googlemail.com>wrote:
> Revision: 49087
>
> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49087
> Author: lukastoenne
> Date: 2012-07-20 17:28:42 +0000 (Fri, 20 Jul 2012)
> Log Message:
> -----------
> Masking: prevent crashes in cases when mask spline is axis aligned
>
> Modified Paths:
> --------------
> branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
>
> Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
> ===================================================================
> --- branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
> 2012-07-20 17:24:23 UTC (rev 49086)
> +++ branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
> 2012-07-20 17:28:42 UTC (rev 49087)
> @@ -574,12 +574,25 @@
> max_delta_y = delta;
> }
>
> + /* 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);
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
--
With best regards, Sergey Sharybin
More information about the Bf-committers
mailing list