From 0651eb9e41d0e6680126456d6b7b665154ab7660 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Tue, 5 Aug 2008 14:33:46 +0000 Subject: Use is_straight_curve() instead of three separate dynamic casts (bzr r6564) --- src/helper/geom.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/helper/geom.cpp') 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 #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(&c) || - dynamic_cast(&c) || - dynamic_cast(&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(&c) || - dynamic_cast(&c) || - dynamic_cast(&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(&*cit) || - dynamic_cast(&*cit) || - dynamic_cast(&*cit) || - dynamic_cast(&*cit) ) + if( dynamic_cast(&*cit) || + is_straight_curve(*cit) ) { output.back().append(*cit); } -- cgit v1.2.3