summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2010-10-27 23:14:51 +0000
committerJohan Engelen <goejendaagh@zonnet.nl>2010-10-27 23:14:51 +0000
commit830da71669d34724d710384308ea9e554f9b5e61 (patch)
treec1f44f1f0f7cbf87314931006e5acf3d6bef8f40 /src
parentUI: punctiation and mnemonics in preferences, export and ico preview dialog (diff)
downloadinkscape-830da71669d34724d710384308ea9e554f9b5e61.tar.gz
inkscape-830da71669d34724d710384308ea9e554f9b5e61.zip
provide specific bounds method for Paths because paths can be closed or open. Path::size() is named somewhat wrong... (already committed to 2geom upstream)
Fixed bugs: - https://launchpad.net/bugs/591586 (bzr r9859)
Diffstat (limited to 'src')
-rw-r--r--src/2geom/crossing.cpp12
-rw-r--r--src/2geom/crossing.h3
2 files changed, 15 insertions, 0 deletions
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<Path> const &p, Crossings const
*/
//}
+// provide specific method for Paths because paths can be closed or open. Path::size() is named somewhat wrong...
+std::vector<Rect> bounds(Path const &a) {
+ std::vector<Rect> 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 <boost/optional/optional.hpp>
+#include <2geom/path.h>
namespace Geom {
@@ -137,6 +138,8 @@ std::vector<Rect> 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<Rect> bounds(Path const &a);
inline void sort_crossings(Crossings &cr, unsigned ix) { std::sort(cr.begin(), cr.end(), CrossingOrder(ix)); }