summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2018-07-10 16:14:19 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2018-08-08 15:52:41 +0300
commit12b8482718bdacb2de14e8aa10059e83ecbf61d1 (patch)
tree95e8454a40b0fefe757b3453250091f1e831d1c8
parent9899518e63de6f12f76be8ee2fb6237af5f3285e (diff)
downloadqtlocation-mapboxgl-12b8482718bdacb2de14e8aa10059e83ecbf61d1.tar.gz
[core] Remove redundant check in scanLine
-rw-r--r--src/mbgl/util/tile_cover.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mbgl/util/tile_cover.cpp b/src/mbgl/util/tile_cover.cpp
index 1392ecb2db..dec31cde8a 100644
--- a/src/mbgl/util/tile_cover.cpp
+++ b/src/mbgl/util/tile_cover.cpp
@@ -127,12 +127,12 @@ std::vector<UnwrappedTileID> tileCover(Point<double> tl,
}
auto scanLine = [&](int32_t x0, int32_t x1, int32_t y) {
- int32_t x;
- if (y >= 0 && y <= maxTilesPerAxis) {
- for (x = x0; x < x1; ++x) {
- const auto dx = x + 0.5 - c.x, dy = y + 0.5 - c.y;
- t.emplace_back(ID{ x, y, dx * dx + dy * dy });
- }
+ double dx, dy;
+ for (int32_t x = x0; x < x1; ++x) {
+ // We don't know which corner of the tile coordinate is the closest,
+ // so add 0.5 to calculate the distance from its tile center.
+ dx = x + 0.5 - c.x; dy = y + 0.5 - c.y;
+ t.emplace_back(ID{ x, y, dx * dx + dy * dy });
}
};