Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core] Make mbgl::toGeometryCoordinate() more accurate #14895

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/mbgl/util/tile_coordinate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class TileCoordinate {
const double scale = std::pow(2.0, tileID.canonical.z);
auto zoomed = TileCoordinate { point, 0 }.zoomTo(tileID.canonical.z);
return {
int16_t(util::clamp<int64_t>((zoomed.p.x - tileID.canonical.x - tileID.wrap * scale) * util::EXTENT,
int16_t(util::clamp<int64_t>(::round((zoomed.p.x - tileID.canonical.x - tileID.wrap * scale) * util::EXTENT),
std::numeric_limits<int16_t>::min(),
std::numeric_limits<int16_t>::max())),
int16_t(util::clamp<int64_t>((zoomed.p.y - tileID.canonical.y) * util::EXTENT,
int16_t(util::clamp<int64_t>(::round((zoomed.p.y - tileID.canonical.y) * util::EXTENT),
std::numeric_limits<int16_t>::min(),
std::numeric_limits<int16_t>::max()))
};
Expand Down