diff options
author | Ansis Brammanis <brammanis@gmail.com> | 2015-01-26 12:19:40 -0800 |
---|---|---|
committer | Ansis Brammanis <brammanis@gmail.com> | 2015-01-26 12:19:40 -0800 |
commit | 60035d77283bded4513b1ff5d45a41673405692a (patch) | |
tree | 23b80d6194dd89dd00c388c7471081d8f92ec764 /src/mbgl/renderer/painter.cpp | |
parent | 7694b0c1eca3e5fcc8c90b6af86334fedb66af7b (diff) | |
parent | 5955ac34939a3191ae5faa313ac617c5afeb4da3 (diff) | |
download | qtlocation-mapboxgl-60035d77283bded4513b1ff5d45a41673405692a.tar.gz |
Merge branch 'no-crossfade'
Conflicts:
src/mbgl/renderer/painter_line.cpp
Diffstat (limited to 'src/mbgl/renderer/painter.cpp')
-rw-r--r-- | src/mbgl/renderer/painter.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp index 724788f216..0fb99826c6 100644 --- a/src/mbgl/renderer/painter.cpp +++ b/src/mbgl/renderer/painter.cpp @@ -232,7 +232,7 @@ void Painter::render(const Style& style, const std::set<util::ptr<StyleSource>>& drawClippingMasks(sources); - frameHistory.record(time, state.getNormalizedZoom()); + recordZoom(time, state.getNormalizedZoom()); // Actually render the layers if (debug::renderTree) { std::cout << "{" << std::endl; indent++; } @@ -460,3 +460,26 @@ mat4 Painter::translatedMatrix(const mat4& matrix, const std::array<float, 2> &t return vtxMatrix; } } + +void Painter::recordZoom(const timestamp time, const float zoom) { + frameHistory.record(time, zoom); + + if (lastZoom < 0) { + // first frame ever + lastIntegerZoom = std::floor(zoom); + lastZoom = zoom; + } + + // check whether an integer zoom level was passed since the last frame + // and if yes, record it with the time. Used for transitioning patterns. + if (std::floor(lastZoom) < std::floor(zoom)) { + lastIntegerZoom = std::floor(zoom); + lastIntegerZoomTime = time; + + } else if (std::floor(lastZoom) > std::floor(zoom)) { + lastIntegerZoom = std::floor(zoom) + 1; + lastIntegerZoomTime = time; + } + + lastZoom = zoom; +} |