diff options
author | Aleksandar Stojiljkovic <aleksandar.stojiljkovic@mapbox.com> | 2019-08-23 12:04:32 +0300 |
---|---|---|
committer | Aleksandar Stojiljkovic <aleksandar.stojiljkovic@mapbox.com> | 2019-08-23 16:43:05 +0300 |
commit | 9eff849c743c6e861404a2c39afa53c4eecdca3d (patch) | |
tree | 6c6eaaaf5f29b1570e3fc00aa5fb9ab16bedb7da /src/mbgl/util/tile_cover.cpp | |
parent | 13d2667035f8e5d8319556a275bb60093e24130d (diff) | |
download | qtlocation-mapboxgl-9eff849c743c6e861404a2c39afa53c4eecdca3d.tar.gz |
[core] Fix tileCover / TileCoordinate fromScreenCoordinate(#15442)
Remove unecessary tile coordinate unproject -> project step.
Unproject+project isn't always a noop and this was the issue leading to wrong cover calculation in high pitch values.
Fixes: https://github.com/mapbox/mapbox-gl-native/issues/15442
Diffstat (limited to 'src/mbgl/util/tile_cover.cpp')
-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 5189b79f26..9e2451e1af 100644 --- a/src/mbgl/util/tile_cover.cpp +++ b/src/mbgl/util/tile_cover.cpp @@ -84,7 +84,7 @@ std::vector<UnwrappedTileID> tileCover(const Point<double>& tl, const Point<double>& br, const Point<double>& bl, const Point<double>& c, - int32_t z) { + uint8_t z) { const int32_t tiles = 1 << z; struct ID { @@ -139,7 +139,7 @@ int32_t coveringZoomLevel(double zoom, style::SourceType type, uint16_t size) { } } -std::vector<UnwrappedTileID> tileCover(const LatLngBounds& bounds_, int32_t z) { +std::vector<UnwrappedTileID> tileCover(const LatLngBounds& bounds_, uint8_t z) { if (bounds_.isEmpty() || bounds_.south() > util::LATITUDE_MAX || bounds_.north() < -util::LATITUDE_MAX) { @@ -159,7 +159,7 @@ std::vector<UnwrappedTileID> tileCover(const LatLngBounds& bounds_, int32_t z) { z); } -std::vector<UnwrappedTileID> tileCover(const TransformState& state, int32_t z) { +std::vector<UnwrappedTileID> tileCover(const TransformState& state, uint8_t z) { assert(state.valid()); const double w = state.getSize().width; @@ -173,7 +173,7 @@ std::vector<UnwrappedTileID> tileCover(const TransformState& state, int32_t z) { z); } -std::vector<UnwrappedTileID> tileCover(const Geometry<double>& geometry, int32_t z) { +std::vector<UnwrappedTileID> tileCover(const Geometry<double>& geometry, uint8_t z) { std::vector<UnwrappedTileID> result; TileCover tc(geometry, z, true); while (tc.hasNext()) { @@ -213,7 +213,7 @@ uint64_t tileCount(const Geometry<double>& geometry, uint8_t z) { return tileCount; } -TileCover::TileCover(const LatLngBounds&bounds_, int32_t z) { +TileCover::TileCover(const LatLngBounds&bounds_, uint8_t z) { LatLngBounds bounds = LatLngBounds::hull( { std::max(bounds_.south(), -util::LATITUDE_MAX), bounds_.west() }, { std::min(bounds_.north(), util::LATITUDE_MAX), bounds_.east() }); @@ -233,7 +233,7 @@ TileCover::TileCover(const LatLngBounds&bounds_, int32_t z) { impl = std::make_unique<TileCover::Impl>(z, p, false); } -TileCover::TileCover(const Geometry<double>& geom, int32_t z, bool project/* = true*/) +TileCover::TileCover(const Geometry<double>& geom, uint8_t z, bool project/* = true*/) : impl( std::make_unique<TileCover::Impl>(z, geom, project)) { } |