1 #include "canvas/line_set.h"
2 #include "canvas/utils.h"
5 using namespace ArdourCanvas;
7 /* XXX: hard-wired to horizontal only */
11 bool operator() (LineSet::Line& a, LineSet::Line& b) {
16 LineSet::LineSet (Group* parent)
25 LineSet::compute_bounding_box () const
27 if (_lines.empty ()) {
28 _bounding_box = boost::optional<Rect> ();
29 _bounding_box_dirty = false;
33 _bounding_box = Rect (0, _lines.front().y, COORD_MAX, min (_height, _lines.back().y));
34 _bounding_box_dirty = false;
38 LineSet::set_height (Distance height)
44 _bounding_box_dirty = true;
49 LineSet::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
51 for (list<Line>::const_iterator i = _lines.begin(); i != _lines.end(); ++i) {
54 } else if (i->y > area.y0) {
55 set_source_rgba (context, i->color);
56 context->set_line_width (i->width);
57 context->move_to (area.x0, i->y);
58 context->line_to (area.x1, i->y);
65 LineSet::add (Coord y, Distance width, Color color)
69 _lines.push_back (Line (y, width, color));
70 _lines.sort (LineSorter ());
72 _bounding_box_dirty = true;
81 _bounding_box_dirty = true;