diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2014-03-31 23:25:06 +0000 |
|---|---|---|
| committer | Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl> | 2014-03-31 23:25:06 +0000 |
| commit | 04b06fe3ed0824c37cf65b425bf820d8b6f226a2 (patch) | |
| tree | ed85a3f16e78220b3e3ae818296e08ee0b59cea4 /src/2geom/path.h | |
| parent | 2geom: silence warning (diff) | |
| download | inkscape-04b06fe3ed0824c37cf65b425bf820d8b6f226a2.tar.gz inkscape-04b06fe3ed0824c37cf65b425bf820d8b6f226a2.zip | |
partial 2geom update:
- main reason for update: better swap for Path (fixes C++11 warning/error)
- faster implementation for Path * Translate (~6x), Inkscape's code has to be modified to use it though
(bzr r13248)
Diffstat (limited to 'src/2geom/path.h')
| -rw-r--r-- | src/2geom/path.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/2geom/path.h b/src/2geom/path.h index 48d7acaaf..28d2a25e4 100644 --- a/src/2geom/path.h +++ b/src/2geom/path.h @@ -40,6 +40,7 @@ #include <boost/shared_ptr.hpp> #include <2geom/curve.h> #include <2geom/bezier-curve.h> +#include <2geom/transforms.h> namespace Geom { @@ -205,11 +206,14 @@ public: // Path &operator=(Path const &other) - use default assignment operator + /// \todo Add noexcept specifiers for C++11 void swap(Path &other) { - std::swap(other.curves_, curves_); - std::swap(other.final_, final_); - std::swap(other.closed_, closed_); + using std::swap; + swap(other.curves_, curves_); + swap(other.final_, final_); + swap(other.closed_, closed_); } + friend inline void swap(Path &a, Path &b) { a.swap(b); } Curve const &operator[](unsigned i) const { return *get_curves()[i]; } Curve const &at_index(unsigned i) const { return *get_curves()[i]; } @@ -289,8 +293,14 @@ public: ret *= m; return ret; } + Path operator*(Translate const &m) const { // specialization over Affine, for faster computation + Path ret(*this); + ret *= m; + return ret; + } Path &operator*=(Affine const &m); + Path &operator*=(Translate const &m); // specialization over Affine, for faster computation Point pointAt(double t) const { @@ -686,14 +696,6 @@ Coord nearest_point(Point const& p, Path const& c) } // end namespace Geom -namespace std { - -template <> -inline void swap<Geom::Path>(Geom::Path &a, Geom::Path &b) { - a.swap(b); -} - -} // end namespace std #endif // LIB2GEOM_SEEN_PATH_H |
