diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-12-28 13:52:08 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-12-28 13:52:08 -0500 |
commit | a585816f3eb0209c7e49ca5cc7127653e7b6c41c (patch) | |
tree | 817ddba9893a8a22ad91d00d24d21455456410da /libs/canvas/poly_item.cc | |
parent | 218a4664bef7357ade83aa6e512fe7bce7813d4d (diff) |
slight optimization of PolyItem::render_path()
Diffstat (limited to 'libs/canvas/poly_item.cc')
-rw-r--r-- | libs/canvas/poly_item.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/libs/canvas/poly_item.cc b/libs/canvas/poly_item.cc index 239ae06e18..ebf744a0b2 100644 --- a/libs/canvas/poly_item.cc +++ b/libs/canvas/poly_item.cc @@ -66,16 +66,15 @@ PolyItem::compute_bounding_box () const void PolyItem::render_path (Rect const & /*area*/, Cairo::RefPtr<Cairo::Context> context) const { - bool done_first = false; - for (Points::const_iterator i = _points.begin(); i != _points.end(); ++i) { - if (done_first) { - Duple c = item_to_window (Duple (i->x, i->y)); - context->line_to (c.x, c.y); - } else { - Duple c = item_to_window (Duple (i->x, i->y)); - context->move_to (c.x, c.y); - done_first = true; - } + Points::const_iterator i = _points.begin(); + Duple c (item_to_window (Duple (i->x, i->y))); + + context->move_to (c.x, c.y); + + while (i != _points.end()) { + c = item_to_window (Duple (i->x, i->y)); + context->line_to (c.x, c.y); + ++i; } } |