summaryrefslogtreecommitdiffstats
path: root/src/live_effects/lpe-interpolate.cpp
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2008-11-21 05:24:08 +0000
committerTed Gould <ted@canonical.com>2008-11-21 05:24:08 +0000
commit44a3a78fb6a3863c0c7f3c1193837337e68a67e4 (patch)
tree1722ee5ec6f88c881cd4124923354b3c1311501b /src/live_effects/lpe-interpolate.cpp
parentMerge from trunk (diff)
downloadinkscape-44a3a78fb6a3863c0c7f3c1193837337e68a67e4.tar.gz
inkscape-44a3a78fb6a3863c0c7f3c1193837337e68a67e4.zip
Merge from fe-moved
(bzr r6891)
Diffstat (limited to 'src/live_effects/lpe-interpolate.cpp')
-rw-r--r--src/live_effects/lpe-interpolate.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/live_effects/lpe-interpolate.cpp b/src/live_effects/lpe-interpolate.cpp
index a4c722acc..b2f1547a9 100644
--- a/src/live_effects/lpe-interpolate.cpp
+++ b/src/live_effects/lpe-interpolate.cpp
@@ -61,8 +61,12 @@ LPEInterpolate::doEffect_path (Geom::PathVector const & path_in)
Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_B = path_in[1].toPwSb();
// Transform both paths to (0,0) midpoint, so they can easily be positioned along interpolate_path
- pwd2_A -= Geom::bounds_exact(pwd2_A).midpoint();
- pwd2_B -= Geom::bounds_exact(pwd2_B).midpoint();
+ if (Geom::OptRect bounds = Geom::bounds_exact(pwd2_A)) {
+ pwd2_A -= bounds->midpoint();
+ }
+ if (Geom::OptRect bounds = Geom::bounds_exact(pwd2_B)) {
+ pwd2_B -= bounds->midpoint();
+ }
// Make sure both paths have the same number of segments and cuts at the same locations
pwd2_B.setDomain(pwd2_A.domain());
@@ -99,14 +103,18 @@ LPEInterpolate::resetDefaults(SPItem * item)
if ( (pathv.size() < 2) )
return;
- Geom::Rect bounds_A = pathv[0].boundsExact();
- Geom::Rect bounds_B = pathv[1].boundsExact();
-
- Geom::PathVector traj_pathv;
- traj_pathv.push_back( Geom::Path() );
- traj_pathv[0].start( bounds_A.midpoint() );
- traj_pathv[0].appendNew<Geom::LineSegment>( bounds_B.midpoint() );
- trajectory_path.set_new_value( traj_pathv, true );
+ Geom::OptRect bounds_A = pathv[0].boundsExact();
+ Geom::OptRect bounds_B = pathv[1].boundsExact();
+
+ if (bounds_A && bounds_B) {
+ Geom::PathVector traj_pathv;
+ traj_pathv.push_back( Geom::Path() );
+ traj_pathv[0].start( bounds_A->midpoint() );
+ traj_pathv[0].appendNew<Geom::LineSegment>( bounds_B->midpoint() );
+ trajectory_path.set_new_value( traj_pathv, true );
+ } else {
+ trajectory_path.param_set_and_write_default();
+ }
}
} //namespace LivePathEffect