diff options
Diffstat (limited to 'src/2geom/path.cpp')
| -rw-r--r-- | src/2geom/path.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/2geom/path.cpp b/src/2geom/path.cpp index 71b7b25bb..e38835776 100644 --- a/src/2geom/path.cpp +++ b/src/2geom/path.cpp @@ -215,6 +215,18 @@ PathInterval PathInterval::from_direction(PathTime const &from, PathTime const & } +Path::Path(Rect const &r) + : _curves(new Sequence()) + , _closing_seg(new ClosingSegment(r.corner(3), r.corner(0))) + , _closed(true) + , _exception_on_stitch(true) +{ + for (unsigned i = 0; i < 3; ++i) { + _curves->push_back(new LineSegment(r.corner(i), r.corner(i+1))); + } + _curves->push_back(_closing_seg); +} + Path::Path(ConvexHull const &ch) : _curves(new Sequence()) , _closing_seg(new ClosingSegment(Point(), Point())) @@ -678,12 +690,12 @@ Path Path::reversed() const typedef std::reverse_iterator<Sequence::const_iterator> RIter; Path ret; - ret._curves->pop_back(); - RIter iter(_curves->end()), rend(_curves->begin()); + ret._curves->pop_back(); // this also deletes the closing segment + RIter iter(_curves->end() - 1), rend(_curves->begin()); for (; iter != rend; ++iter) { ret._curves->push_back(iter->reverse()); } - ret._closing_seg = static_cast<ClosingSegment *>(ret._closing_seg->reverse()); + ret._closing_seg = static_cast<ClosingSegment *>(_closing_seg->reverse()); ret._curves->push_back(ret._closing_seg); return ret; } |
