diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-07-04 22:52:34 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-07-04 22:52:34 +0000 |
| commit | 53e243dd44711327f8912970fd46d1a46269d328 (patch) | |
| tree | 5df6d56bd48cfa27557aaf90bf2db7a97197debb /src/display | |
| parent | convert a path to guides using 2geom calls (diff) | |
| download | inkscape-53e243dd44711327f8912970fd46d1a46269d328.tar.gz inkscape-53e243dd44711327f8912970fd46d1a46269d328.zip | |
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)
Diffstat (limited to 'src/display')
| -rw-r--r-- | src/display/inkscape-cairo.cpp | 7 | ||||
| -rw-r--r-- | src/display/nr-arena-shape.cpp | 12 |
2 files changed, 9 insertions, 10 deletions
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 <cairo.h> -#include <typeinfo> #ifdef HAVE_CONFIG_H # include <config.h> #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<Geom::LineSegment const*>(&c) || + dynamic_cast<Geom::HLineSegment const*>(&c) || + dynamic_cast<Geom::VLineSegment const*>(&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<Geom::LineSegment const*>(c) || + dynamic_cast<Geom::HLineSegment const*>(c) || + dynamic_cast<Geom::VLineSegment const*>(c) ) + { return false; + } } return true; //too costly to see if it has region to be filled, so return true. |
