X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fcanvas%2Fpoly_item.cc;h=855140856eb0f3ccdb60cbcd0d2f93870d67d22c;hb=c8c6bca6587450ff64303dbc994a4cd28d6ce7aa;hp=88b9af78781cbc28a4242287daac5a9ab2e240e0;hpb=032f394b2a0b975bc47760035de8e25310747972;p=ardour.git diff --git a/libs/canvas/poly_item.cc b/libs/canvas/poly_item.cc index 88b9af7878..855140856e 100644 --- a/libs/canvas/poly_item.cc +++ b/libs/canvas/poly_item.cc @@ -27,22 +27,25 @@ using namespace std; using namespace ArdourCanvas; -PolyItem::PolyItem (Group* parent) - : Item (parent) - , Outline (parent) +PolyItem::PolyItem (Canvas* c) + : Item (c) { +} +PolyItem::PolyItem (Item* parent) + : Item (parent) +{ } void PolyItem::compute_bounding_box () const { - + if (!_points.empty()) { Rect bbox; Points::const_iterator i = _points.begin(); - + bbox.x0 = bbox.x1 = i->x; bbox.y0 = bbox.y1 = i->y; @@ -56,13 +59,13 @@ PolyItem::compute_bounding_box () const ++i; } - _bounding_box = bbox.expand (_outline_width); + _bounding_box = bbox.expand (_outline_width + 0.5); + - } else { _bounding_box = boost::optional (); } - + _bounding_box_dirty = false; } @@ -110,14 +113,14 @@ PolyItem::render_curve (Rect const & area, Cairo::RefPtr context Duple c2 = item_to_window (Duple (cp2->x, cp2->y)); c = item_to_window (Duple (p->x, p->y)); - - context->curve_to (c1.x + pixel_adjust, - c1.y + pixel_adjust, - c2.x + pixel_adjust, - c2.y + pixel_adjust, - c.x + pixel_adjust, + + context->curve_to (c1.x + pixel_adjust, + c1.y + pixel_adjust, + c2.x + pixel_adjust, + c2.y + pixel_adjust, + c.x + pixel_adjust, c.y + pixel_adjust); - + ++cp1; ++cp2; ++p; @@ -127,12 +130,15 @@ PolyItem::render_curve (Rect const & area, Cairo::RefPtr context void PolyItem::set (Points const & points) { - begin_change (); - - _points = points; - - _bounding_box_dirty = true; - end_change (); + if (_points != points) { + + begin_change (); + + _points = points; + + _bounding_box_dirty = true; + end_change (); + } } Points const &