/*! \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
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
struct Layer_Shape::Intersector
{
Rect aabb;
+
+ //! true iff aabb hasn't been initialised yet
bool initaabb;
int flags;
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);
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;
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;
}