simplify Canvas::Rectangle rendering to avoid unnecessary nonsense, and remove TimeRe...
[ardour.git] / libs / canvas / poly_item.cc
index eeb186fd7fcf556bcd901ef7f2ac7c6542d5f400..c66c3bbb7a34e81f53ca7fd353fa5147bbc0d33b 100644 (file)
 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
@@ -45,7 +48,9 @@ PolyItem::compute_bounding_box () const
                
                bbox.x0 = bbox.x1 = i->x;
                bbox.y0 = bbox.y1 = i->y;
-               
+
+               ++i;
+
                while (i != _points.end()) {
                        bbox.x0 = min (bbox.x0, i->x);
                        bbox.y0 = min (bbox.y0, i->y);
@@ -54,7 +59,7 @@ PolyItem::compute_bounding_box () const
                        ++i;
                }
 
-               _bounding_box = bbox.expand (_outline_width / 2);
+               _bounding_box = bbox.expand (_outline_width + 0.5);
 
                
        } else {
@@ -125,12 +130,15 @@ PolyItem::render_curve (Rect const & area, Cairo::RefPtr<Cairo::Context> 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 &