From a585816f3eb0209c7e49ca5cc7127653e7b6c41c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 28 Dec 2013 13:52:08 -0500 Subject: [PATCH] slight optimization of PolyItem::render_path() --- libs/canvas/poly_item.cc | 19 +++++++++---------- 1 file 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 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; } }