diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2018-07-10 16:14:19 +0300 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-03-06 09:40:21 +0200 |
commit | 9083fb1570eab2e2253931a0d32c49169f3f52d6 (patch) | |
tree | fd0b35028f9a5f06c946f6470aa2538827cecb14 | |
parent | c2823efc82d96c9f8fa35eb0a6df4172dbccb8a5 (diff) |
[core] Remove redundant check in scanLine
-rw-r--r-- | src/mbgl/util/tile_cover.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mbgl/util/tile_cover.cpp b/src/mbgl/util/tile_cover.cpp index 4e6da338f..2b28c46cc 100644 --- a/src/mbgl/util/tile_cover.cpp +++ b/src/mbgl/util/tile_cover.cpp @@ -95,12 +95,12 @@ std::vector<UnwrappedTileID> tileCover(const Point<double>& tl, std::vector<ID> t; auto scanLine = [&](int32_t x0, int32_t x1, int32_t y) { - int32_t x; - if (y >= 0 && y <= tiles) { - 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 }); } }; |