- 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;
- }
+ if (_points.size() < 2) {
+ return;
+ }
+
+ Points::const_iterator i = _points.begin();
+ Duple c (item_to_window (Duple (i->x, i->y)));
+
+ context->move_to (c.x, c.y);
+ ++i;
+
+ while (i != _points.end()) {
+ c = item_to_window (Duple (i->x, i->y));
+ context->line_to (c.x, c.y);
+ ++i;