diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-17 18:03:25 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-18 10:46:10 -0800 |
commit | e2ad0e008a404b27314d4a2892d733f2f13656bf (patch) | |
tree | 23456f875d244076211add667ede72563c903b67 /src/mbgl/renderer | |
parent | b8aee772993b984a40bfc3c04f9f0bd92721f4a6 (diff) | |
download | qtlocation-mapboxgl-e2ad0e008a404b27314d4a2892d733f2f13656bf.tar.gz |
[core] Fix background-pattern origin
Regressed in 6e41664cb033ee5edf6ae5ac66ed518d9f0d1f89. This restores it
to the same behavior as gl-js, backed by test-suite tests.
Diffstat (limited to 'src/mbgl/renderer')
-rw-r--r-- | src/mbgl/renderer/painter.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp index ebffa6f3ae..35bc10ab6e 100644 --- a/src/mbgl/renderer/painter.cpp +++ b/src/mbgl/renderer/painter.cpp @@ -34,6 +34,7 @@ #include <mbgl/util/constants.hpp> #include <mbgl/util/mat3.hpp> +#include <mbgl/util/tile_coordinate.hpp> #if defined(DEBUG) #include <mbgl/util/stopwatch.hpp> @@ -279,7 +280,7 @@ void Painter::renderBackground(const BackgroundLayer& layer) { patternShader->u_opacity = properties.opacity; LatLng latLng = state.getLatLng(); - PrecisionPoint center = state.latLngToPoint(latLng); + TileCoordinate center = state.latLngToCoordinate(latLng); float scale = 1 / std::pow(2, zoomFraction); std::array<float, 2> sizeA = (*imagePosA).size; @@ -289,8 +290,8 @@ void Painter::renderBackground(const BackgroundLayer& layer) { 1.0f / (sizeA[0] * properties.pattern.value.fromScale), 1.0f / (sizeA[1] * properties.pattern.value.fromScale)); matrix::translate(matrixA, matrixA, - std::fmod(center.x * 512, sizeA[0] * properties.pattern.value.fromScale), - std::fmod(center.y * 512, sizeA[1] * properties.pattern.value.fromScale)); + std::fmod(center.column * util::tileSize, sizeA[0] * properties.pattern.value.fromScale), + std::fmod(center.row * util::tileSize, sizeA[1] * properties.pattern.value.fromScale)); matrix::rotate(matrixA, matrixA, -state.getAngle()); matrix::scale(matrixA, matrixA, scale * state.getWidth() / 2, @@ -303,8 +304,8 @@ void Painter::renderBackground(const BackgroundLayer& layer) { 1.0f / (sizeB[0] * properties.pattern.value.toScale), 1.0f / (sizeB[1] * properties.pattern.value.toScale)); matrix::translate(matrixB, matrixB, - std::fmod(center.x * 512, sizeB[0] * properties.pattern.value.toScale), - std::fmod(center.y * 512, sizeB[1] * properties.pattern.value.toScale)); + std::fmod(center.column * util::tileSize, sizeB[0] * properties.pattern.value.toScale), + std::fmod(center.row * util::tileSize, sizeB[1] * properties.pattern.value.toScale)); matrix::rotate(matrixB, matrixB, -state.getAngle()); matrix::scale(matrixB, matrixB, scale * state.getWidth() / 2, |