Fix 1694325: when looping wasn't enabled, the region was being closed by looping...
[synfig.git] / synfig-core / trunk / src / synfig / layer_shape.cpp
index 28f0dc8..87b447f 100644 (file)
@@ -2,7 +2,7 @@
 /*!    \file layer_shape.cpp
 **     \brief Template Header
 **
-**     $Id: layer_shape.cpp,v 1.2 2005/01/24 03:08:18 darco Exp $
+**     $Id$
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
@@ -62,7 +62,7 @@ SYNFIG_LAYER_SET_NAME(Layer_Shape,"shape");
 SYNFIG_LAYER_SET_LOCAL_NAME(Layer_Shape,_("Shape"));
 SYNFIG_LAYER_SET_CATEGORY(Layer_Shape,_("Internal"));
 SYNFIG_LAYER_SET_VERSION(Layer_Shape,"0.1");
-SYNFIG_LAYER_SET_CVS_ID(Layer_Shape,"$Id: layer_shape.cpp,v 1.2 2005/01/24 03:08:18 darco Exp $");
+SYNFIG_LAYER_SET_CVS_ID(Layer_Shape,"$Id$");
 
 #define EPSILON        1e-12
 
@@ -711,6 +711,8 @@ struct CurveArray
 struct Layer_Shape::Intersector
 {
        Rect    aabb;
+
+       //! true iff aabb hasn't been initialised yet
        bool    initaabb;
 
        int     flags;
@@ -769,7 +771,7 @@ struct Layer_Shape::Intersector
                int dir = (y > cur_y)*1 + (-1)*(y < cur_y);
 
                //check for context (if not line start a new segment)
-               //if we're not in line mode (cover's 0 set case), or if directions are different (not valid for 0 direction)
+               //if we're not in line mode (covers 0 set case), or if directions are different (not valid for 0 direction)
                if(prim != TYPE_LINE || (dir && segs.back().ydir != dir))
                {
                        MonoSegment             seg(dir,x,x,y,y);
@@ -790,7 +792,7 @@ struct Layer_Shape::Intersector
 
                cur_x = x;
                cur_y = y;
-               aabb.expand(x,y); //expand the entire things bounding box
+               aabb.expand(x,y); //expand the entire thing's bounding box
 
                tangent[0] = x - cur_x;
                tangent[1] = x - cur_y;
@@ -3066,9 +3068,12 @@ Layer_Shape::get_bounding_rect()const
        if(invert)
                return Rect::full_plane();
 
-       Rect bounds(edge_table->aabb+offset);
-       bounds.expand(max((bounds.get_min()-bounds.get_max()).mag()*0.01,feather));
+       if (edge_table->initaabb)
+               return Rect::zero();
 
+       Rect bounds(edge_table->aabb+offset);
+       bounds.expand(max((bounds.get_min() - bounds.get_max()).mag()*0.01,
+                                         feather));
 
        return bounds;
 }