diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2008-08-05 14:33:46 +0000 |
|---|---|---|
| committer | dvlierop2 <dvlierop2@users.sourceforge.net> | 2008-08-05 14:33:46 +0000 |
| commit | 0651eb9e41d0e6680126456d6b7b665154ab7660 (patch) | |
| tree | 794a0b30225009643ef882d51010bce5c8ae9cf8 /src/helper/geom.cpp | |
| parent | more mockup on svgfonts dialog (diff) | |
| download | inkscape-0651eb9e41d0e6680126456d6b7b665154ab7660.tar.gz inkscape-0651eb9e41d0e6680126456d6b7b665154ab7660.zip | |
Use is_straight_curve() instead of three separate dynamic casts
(bzr r6564)
Diffstat (limited to 'src/helper/geom.cpp')
| -rw-r--r-- | src/helper/geom.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/helper/geom.cpp b/src/helper/geom.cpp index ac8930412..bf487f652 100644 --- a/src/helper/geom.cpp +++ b/src/helper/geom.cpp @@ -12,6 +12,7 @@ */ #include "helper/geom.h" +#include "helper/geom-curves.h" #include <typeinfo> #include <2geom/pathvector.h> #include <2geom/path.h> @@ -173,9 +174,7 @@ bounds_exact_transformed(Geom::PathVector const & pv, Geom::Matrix const & t) for (Geom::Path::const_iterator cit = it->begin(); cit != it->end_open(); ++cit) { Geom::Curve const &c = *cit; - if( dynamic_cast<Geom::LineSegment const*>(&c) || - dynamic_cast<Geom::HLineSegment const*>(&c) || - dynamic_cast<Geom::VLineSegment const*>(&c) ) + if( is_straight_curve(c) ) { bbox.expandTo( c.finalPoint() * t ); } @@ -363,9 +362,7 @@ geom_curve_bbox_wind_distance(Geom::Curve const & c, Geom::Matrix const &m, Geom::Coord tolerance, Geom::Rect const *viewbox, Geom::Point &p0) // pass p0 through as it represents the last endpoint added (the finalPoint of last curve) { - if( dynamic_cast<Geom::LineSegment const*>(&c) || - dynamic_cast<Geom::HLineSegment const*>(&c) || - dynamic_cast<Geom::VLineSegment const*>(&c) ) + if( is_straight_curve(c) ) { Geom::Point pe = c.finalPoint() * m; if (bbox) { @@ -509,10 +506,8 @@ pathv_to_linear_and_cubic_beziers( Geom::PathVector const &pathv ) output.back().close( pit->closed() ); for (Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_open(); ++cit) { - if( dynamic_cast<Geom::CubicBezier const*>(&*cit) || - dynamic_cast<Geom::LineSegment const*>(&*cit) || - dynamic_cast<Geom::HLineSegment const*>(&*cit) || - dynamic_cast<Geom::VLineSegment const*>(&*cit) ) + if( dynamic_cast<Geom::CubicBezier const*>(&*cit) || + is_straight_curve(*cit) ) { output.back().append(*cit); } |
