From: Johan Engelen Date: Wed, 27 Oct 2010 23:14:51 +0000 (+0200) Subject: provide specific bounds method for Paths because paths can be closed or open. Path... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f02adf79d5fa69f8132c8bb27cdede593a9caba8;p=inkscape.git provide specific bounds method for Paths because paths can be closed or open. Path::size() is named somewhat wrong... (already committed to 2geom upstream) --- diff --git a/src/2geom/crossing.cpp b/src/2geom/crossing.cpp index d717a4ed5..91180a939 100644 --- a/src/2geom/crossing.cpp +++ b/src/2geom/crossing.cpp @@ -113,6 +113,18 @@ CrossingGraph create_crossing_graph(std::vector const &p, Crossings const */ //} +// provide specific method for Paths because paths can be closed or open. Path::size() is named somewhat wrong... +std::vector bounds(Path const &a) { + std::vector rs; + for (unsigned i = 0; i < a.size_default(); i++) { + OptRect bb = a[i].boundsFast(); + if (bb) { + rs.push_back(*bb); + } + } + return rs; +} + void merge_crossings(Crossings &a, Crossings &b, unsigned i) { Crossings n; sort_crossings(b, i); diff --git a/src/2geom/crossing.h b/src/2geom/crossing.h index 427848033..593ce3662 100644 --- a/src/2geom/crossing.h +++ b/src/2geom/crossing.h @@ -40,6 +40,7 @@ #include <2geom/rect.h> #include <2geom/sweep.h> #include +#include <2geom/path.h> namespace Geom { @@ -137,6 +138,8 @@ std::vector bounds(C const &a) { } return rs; } +// provide specific method for Paths because paths can be closed or open. Path::size() is named somewhat wrong... +std::vector bounds(Path const &a); inline void sort_crossings(Crossings &cr, unsigned ix) { std::sort(cr.begin(), cr.end(), CrossingOrder(ix)); }