diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-05-29 14:07:32 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2018-06-04 10:43:21 +0200 |
commit | d66251234d7c0feb875b9490ca945ee9d43306c1 (patch) | |
tree | 3c661091edb98ac15a8711e93fde774a5e6e824a /src/mbgl/renderer | |
parent | d232a7a6f30927cb7e9107c9357bc53e2b1ae0f9 (diff) | |
download | qtlocation-mapboxgl-d66251234d7c0feb875b9490ca945ee9d43306c1.tar.gz |
[core] don't use floating point versions of pow/log
GLIBC 2.27 added new versioned symbols of powf and logf, while the double versions of pow and log remained stable.
Prefer the double version to avoid introducing a dependency on a newer version of GLIBC than strictly necessary.
See https://lists.gnu.org/archive/html/info-gnu/2018-02/msg00000.html
Diffstat (limited to 'src/mbgl/renderer')
-rw-r--r-- | src/mbgl/renderer/layers/render_symbol_layer.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/renderer/sources/render_image_source.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index e48c0e2f92..3a3545122e 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -234,7 +234,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) { static const CollisionBoxProgram::PaintPropertyBinders paintAttributeData(properties, 0); auto pixelRatio = tile.id.pixelsToTileUnits(1, parameters.state.getZoom()); - auto scale = std::pow(2.0f, float(parameters.state.getZoom() - tile.tile.id.overscaledZ)); + const float scale = std::pow(2, parameters.state.getZoom() - tile.tile.id.overscaledZ); std::array<float,2> extrudeScale = {{ parameters.pixelsToGLUnits[0] / (pixelRatio * scale), @@ -267,7 +267,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) { static const CollisionBoxProgram::PaintPropertyBinders paintAttributeData(properties, 0); auto pixelRatio = tile.id.pixelsToTileUnits(1, parameters.state.getZoom()); - auto scale = std::pow(2.0f, float(parameters.state.getZoom() - tile.tile.id.overscaledZ)); + const float scale = std::pow(2, parameters.state.getZoom() - tile.tile.id.overscaledZ); std::array<float,2> extrudeScale = {{ parameters.pixelsToGLUnits[0] / (pixelRatio * scale), diff --git a/src/mbgl/renderer/sources/render_image_source.cpp b/src/mbgl/renderer/sources/render_image_source.cpp index dce5e40185..2ce046a7a0 100644 --- a/src/mbgl/renderer/sources/render_image_source.cpp +++ b/src/mbgl/renderer/sources/render_image_source.cpp @@ -139,7 +139,7 @@ void RenderImageSource::update(Immutable<style::Source::Impl> baseImpl_, auto dx = nePoint.x - swPoint.x; auto dy = nePoint.y - swPoint.y; auto dMax = std::max(dx, dy); - double zoom = std::max(0.0, std::floor(-util::log2(dMax))); + double zoom = std::max(0.0, std::floor(-::log2(dMax))); // Only enable if the long side of the image is > 2 pixels. Resulting in a // display of at least 2 x 1 px image |