From 359a9f0a5ac6097cab24a28aaf0569cc78556bca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Tue, 8 Aug 2017 18:41:19 +0200 Subject: [PATCH] Avoid error summing when computing map positions --- src/atlas.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/atlas.cpp b/src/atlas.cpp index 4a65f198..7e33d515 100644 --- a/src/atlas.cpp +++ b/src/atlas.cpp @@ -85,23 +85,21 @@ void Atlas::computeBounds() offsets.append(QPointF()); for (int z = 0; z < _zooms.count(); z++) { - qreal w = 0, h = 0; - QList m; for (int i = _zooms.at(z).first; i <= _zooms.at(z).second; i++) m.append(_maps.at(i)); qSort(m.begin(), m.end(), xCmp); - offsets[_maps.indexOf(m.first())].setX(w); + offsets[_maps.indexOf(m.first())].setX(0); for (int i = 1; i < m.size(); i++) { - w += round(m.at(i-1)->pp2xy(TL(m.at(i))).x()); + qreal w = round(m.first()->pp2xy(TL(m.at(i))).x()); offsets[_maps.indexOf(m.at(i))].setX(w); } qSort(m.begin(), m.end(), yCmp); - offsets[_maps.indexOf(m.first())].setY(h); + offsets[_maps.indexOf(m.first())].setY(0); for (int i = 1; i < m.size(); i++) { - h += round(m.at(i-1)->pp2xy(TL(m.at(i))).y()); + qreal h = round(m.first()->pp2xy(TL(m.at(i))).y()); offsets[_maps.indexOf(m.at(i))].setY(h); } }