summaryrefslogtreecommitdiff
path: root/src/mbgl/map/transform_state.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-03-08 17:18:57 +0100
committerKonstantin Käfer <mail@kkaefer.com>2016-05-10 14:50:56 +0200
commitdde59eaf769dc2d503e8bd4ca79d0923ad877e13 (patch)
tree1743d0a0d7c50fbc2c686c6e02de838aa69dbb96 /src/mbgl/map/transform_state.cpp
parent5b640fb446693c42086489cdaa3066eb172609e6 (diff)
downloadqtlocation-mapboxgl-dde59eaf769dc2d503e8bd4ca79d0923ad877e13.tar.gz
[core] move Painter and dependents to new *TileID classes
Diffstat (limited to 'src/mbgl/map/transform_state.cpp')
-rw-r--r--src/mbgl/map/transform_state.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mbgl/map/transform_state.cpp b/src/mbgl/map/transform_state.cpp
index 4c96abcd13..2813d6334e 100644
--- a/src/mbgl/map/transform_state.cpp
+++ b/src/mbgl/map/transform_state.cpp
@@ -1,5 +1,5 @@
#include <mbgl/map/transform_state.hpp>
-#include <mbgl/map/tile_id.hpp>
+#include <mbgl/tile/tile_id.hpp>
#include <mbgl/util/constants.hpp>
#include <mbgl/util/interpolate.hpp>
#include <mbgl/util/math.hpp>
@@ -14,12 +14,14 @@ TransformState::TransformState(ConstrainMode constrainMode_)
#pragma mark - Matrix
-void TransformState::matrixFor(mat4& matrix, const TileID& id, const int8_t z) const {
- const double tile_scale = std::pow(2, z);
- double s = worldSize() / tile_scale;
+void TransformState::matrixFor(mat4& matrix, const UnwrappedTileID& tileID) const {
+ const uint64_t tileScale = 1ull << tileID.canonical.z;
+ const double s = worldSize() / tileScale;
matrix::identity(matrix);
- matrix::translate(matrix, matrix, id.x * s, id.y * s, 0);
+ matrix::translate(matrix, matrix,
+ static_cast<int64_t>(tileID.canonical.x + tileID.wrap * tileScale) * s,
+ static_cast<int64_t>(tileID.canonical.y) * s, 0);
matrix::scale(matrix, matrix, s / util::EXTENT, s / util::EXTENT, 1);
}