diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-29 15:00:14 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-29 15:00:14 +0200 |
commit | aa752ffb9f2b331a29dcddd634b217b60b2e6090 (patch) | |
tree | 2129e814470837b5c84a2efbad7873d248fd14ad /src | |
parent | 28fc7d77be8f0e127948fca3d5de639eea9d6b84 (diff) |
optimize set_labels()
Diffstat (limited to 'src')
-rw-r--r-- | src/GipfelWidget.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index e334484..e30443c 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -355,7 +355,7 @@ GipfelWidget::set_labels(Hills *v) { m->label_x = (int) fl_width(m->name) + 1; m->label_y = 0; - for (int j = 0; j < i; j++) { + for (int j = i; j > 0; j--) { Hill *n = v->get(j); if (n->flags & (Hill::DUPLICATE | Hill::TRACK_POINT)) @@ -364,9 +364,10 @@ GipfelWidget::set_labels(Hills *v) { if (!show_hidden && (n->flags & Hill::HIDDEN)) continue; - if (overlap(m->x, m->label_x, - n->x - CROSS_SIZE, n->label_x + CROSS_SIZE)) + if (overlap(m->x, m->label_x, n->x - CROSS_SIZE, n->label_x)) colliding.add(n); + else + break; } colliding.sort(Hills::SORT_LABEL_Y); |