X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fcanvas%2Fpoly_line.cc;h=3150907db6f17aec5fec9f16e362444bac54ff99;hb=289078f7f8224ec72fb23d81b0e2b53a09611cfa;hp=bade7d855e912c429125ac5c3a70bdda6ec39004;hpb=590882f3c8e063528452d71daffb36d3151da05e;p=ardour.git diff --git a/libs/canvas/poly_line.cc b/libs/canvas/poly_line.cc index bade7d855e..3150907db6 100644 --- a/libs/canvas/poly_line.cc +++ b/libs/canvas/poly_line.cc @@ -31,8 +31,8 @@ PolyLine::PolyLine (Canvas* c) { } -PolyLine::PolyLine (Group* g) - : PolyItem (g) +PolyLine::PolyLine (Item* parent) + : PolyItem (parent) , _threshold (1.0) { } @@ -47,6 +47,30 @@ PolyLine::render (Rect const & area, Cairo::RefPtr context) cons } } +void +PolyLine::set_steps (Points const & points, bool stepped) +{ + if (!stepped) { + PolyItem::set(points); + return; + } + + Points copy; + for (Points::const_iterator p = points.begin(); p != points.end();) { + Points::const_iterator next = p; + ++next; + + copy.push_back(*p); + if (next != points.end() && next->x != p->x) { + copy.push_back(Duple(next->x, p->y)); + } + + p = next; + } + + PolyItem::set(copy); +} + bool PolyLine::covers (Duple const & point) const {