From 53e243dd44711327f8912970fd46d1a46269d328 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 4 Jul 2008 22:52:34 +0000 Subject: use if(dynamic_cast<>) instead of if(typeid==) to check 2geom segment types for straightlines. this because the closing line segment is special class ClosingSegment : public LineSegment. (bzr r6158) --- src/display/inkscape-cairo.cpp | 7 +++---- src/display/nr-arena-shape.cpp | 12 ++++++------ 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src/display') diff --git a/src/display/inkscape-cairo.cpp b/src/display/inkscape-cairo.cpp index 9a114f48e..b67ac1311 100644 --- a/src/display/inkscape-cairo.cpp +++ b/src/display/inkscape-cairo.cpp @@ -10,7 +10,6 @@ #include -#include #ifdef HAVE_CONFIG_H # include #endif @@ -160,9 +159,9 @@ feed_curve_to_cairo (cairo_t *ct, NArtBpath const *bpath, NR::Matrix trans, NR:: static void feed_curve_to_cairo(cairo_t *cr, Geom::Curve const &c, Geom::Matrix & trans, Geom::Rect view, bool optimize_stroke) { - if( typeid(c) == typeid(Geom::LineSegment) || - typeid(c) == typeid(Geom::HLineSegment) || - typeid(c) == typeid(Geom::VLineSegment) ) + if( dynamic_cast(&c) || + dynamic_cast(&c) || + dynamic_cast(&c) ) { Geom::Point end_tr = c.finalPoint() * trans; if (!optimize_stroke) { diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index 6974b0008..23bf70be5 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -426,13 +426,13 @@ static bool has_inner_area(Geom::PathVector const & pv) { if ( (pv.size() == 1) && (pv.front().size() <= 1) ) { // vector has only one path with only one segment, see if that's a non-curve segment: that would mean no internal region - Geom::Curve const & c = pv.front().front(); - if ( typeid(c) == typeid(Geom::LineSegment) ) - return false; - if ( typeid(c) == typeid(Geom::HLineSegment) ) - return false; - if ( typeid(c) == typeid(Geom::VLineSegment) ) + Geom::Curve const * c = & pv.front().front(); + if ( dynamic_cast(c) || + dynamic_cast(c) || + dynamic_cast(c) ) + { return false; + } } return true; //too costly to see if it has region to be filled, so return true. -- cgit v1.2.3