Code

Merge from fe-moved
[inkscape.git] / src / 2geom / path.cpp
index c04d9d08d4c7d3ddf134ffce434f6d0fd61602f5..136e6d4818fee5048c70065a9aeecb9f2a67dd05 100644 (file)
@@ -43,21 +43,21 @@ using namespace Geom::PathInternal;
 namespace Geom
 {
 
-Rect Path::boundsFast() const {
-  Rect bounds;
+OptRect Path::boundsFast() const {
+  OptRect bounds;
   if (empty()) return bounds;
   bounds=front().boundsFast();
   const_iterator iter = begin();
   if ( iter != end() ) {
-         for ( ++iter; iter != end() ; ++iter ) {
-           bounds.unionWith(iter->boundsFast());
-         }
+    for ( ++iter; iter != end() ; ++iter ) {
+      bounds.unionWith(iter->boundsFast());
+    }
   }
   return bounds;
 }
 
-Rect Path::boundsExact() const {
-  Rect bounds;
+OptRect Path::boundsExact() const {
+  OptRect bounds;
   if (empty()) return bounds;
   bounds=front().boundsExact();
   const_iterator iter = begin();
@@ -143,10 +143,10 @@ Path::allNearestPoints(Point const& _point, double from, double to) const
        double dsq;
        double mindistsq
                = distanceSq( _point, _path[si].pointAt( all_np.front().front() ) );
-       Rect bb;
+       Rect bb(Geom::Point(0,0),Geom::Point(0,0));
        for ( unsigned int i = si + 1; i < ei; ++i )
        {
-               bb = _path[i].boundsFast();
+               bb = *(_path[i].boundsFast());
                dsq = distanceSq(_point, bb);
                if ( mindistsq < dsq ) continue;
                all_t = _path[i].allNearestPoints(_point);
@@ -165,7 +165,7 @@ Path::allNearestPoints(Point const& _point, double from, double to) const
                        ni.push_back(i);
                }
        }
-       bb = _path[ei].boundsFast();
+       bb = *(_path[ei].boundsFast());
        dsq = distanceSq(_point, bb);
        if ( mindistsq >= dsq )
        {
@@ -254,10 +254,10 @@ double Path::nearestPoint(Point const &_point, double from, double to, double *d
        unsigned int ni = si;
        double dsq;
        double mindistsq = distanceSq(_point, _path[si].pointAt(nearest));
-       Rect bb;
+       Rect bb(Geom::Point(0,0),Geom::Point(0,0));
        for ( unsigned int i = si + 1; i < ei; ++i )
        {
-               bb = _path[i].boundsFast();
+               bb = *(_path[i].boundsFast());
                dsq = distanceSq(_point, bb);
                if ( mindistsq <= dsq ) continue;
                t = _path[i].nearestPoint(_point);
@@ -269,7 +269,7 @@ double Path::nearestPoint(Point const &_point, double from, double to, double *d
                        mindistsq = dsq;
                }
        }
-       bb = _path[ei].boundsFast();
+       bb = *(_path[ei].boundsFast());
        dsq = distanceSq(_point, bb);
        if ( mindistsq > dsq )
        {