diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-06-21 14:44:00 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2018-09-11 11:43:54 +0200 |
commit | 4a3c4edb59b6881a30056531bc71e52295ab1cb0 (patch) | |
tree | b1c466667efc84cd5f7345d977032155f315ec76 /src/mbgl | |
parent | 30e570aae7d2ba5522feafb962b334ef3f35459e (diff) | |
download | qtlocation-mapboxgl-4a3c4edb59b6881a30056531bc71e52295ab1cb0.tar.gz |
[android] add support for gnustl
Diffstat (limited to 'src/mbgl')
-rw-r--r-- | src/mbgl/map/map.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/map/transform_state.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/sources/render_image_source.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/style/expression/compound_expression.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/text/collision_feature.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/util/dtoa.hpp | 5 | ||||
-rw-r--r-- | src/mbgl/util/tile_cover.cpp | 2 |
7 files changed, 11 insertions, 6 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index c177299485..ddac5c5c8f 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -402,7 +402,7 @@ CameraOptions cameraForLatLngs(const std::vector<LatLng>& latLngs, const Transfo scaleY -= (padding.top() + padding.bottom()) / height; minScale = util::min(scaleX, scaleY); } - double zoom = transform.getZoom() + ::log2(minScale); + double zoom = transform.getZoom() + util::log2(minScale); zoom = util::clamp(zoom, transform.getState().getMinZoom(), transform.getState().getMaxZoom()); // Calculate the center point of a virtual bounds that is extended in all directions by padding. diff --git a/src/mbgl/map/transform_state.cpp b/src/mbgl/map/transform_state.cpp index 948954570f..9ff68a1a60 100644 --- a/src/mbgl/map/transform_state.cpp +++ b/src/mbgl/map/transform_state.cpp @@ -270,7 +270,7 @@ double TransformState::zoomScale(double zoom) const { } double TransformState::scaleZoom(double s) const { - return ::log2(s); + return util::log2(s); } ScreenCoordinate TransformState::latLngToScreenCoordinate(const LatLng& latLng) const { diff --git a/src/mbgl/renderer/sources/render_image_source.cpp b/src/mbgl/renderer/sources/render_image_source.cpp index d4577e787a..f9ae5588d1 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(-::log2(dMax))); + double zoom = std::max(0.0, std::floor(-util::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 diff --git a/src/mbgl/style/expression/compound_expression.cpp b/src/mbgl/style/expression/compound_expression.cpp index 2e823ff43d..6e87167d5a 100644 --- a/src/mbgl/style/expression/compound_expression.cpp +++ b/src/mbgl/style/expression/compound_expression.cpp @@ -467,7 +467,7 @@ std::unordered_map<std::string, CompoundExpressionRegistry::Definition> initiali define("sqrt", [](double x) -> Result<double> { return sqrt(x); }); define("log10", [](double x) -> Result<double> { return log10(x); }); define("ln", [](double x) -> Result<double> { return log(x); }); - define("log2", [](double x) -> Result<double> { return log2(x); }); + define("log2", [](double x) -> Result<double> { return util::log2(x); }); define("sin", [](double x) -> Result<double> { return sin(x); }); define("cos", [](double x) -> Result<double> { return cos(x); }); define("tan", [](double x) -> Result<double> { return tan(x); }); diff --git a/src/mbgl/text/collision_feature.cpp b/src/mbgl/text/collision_feature.cpp index ac4dbff2af..ee7322e692 100644 --- a/src/mbgl/text/collision_feature.cpp +++ b/src/mbgl/text/collision_feature.cpp @@ -52,7 +52,7 @@ void CollisionFeature::bboxifyLabel(const GeometryCoordinates& line, GeometryCoo // symbol spacing will put labels very close together in a pitched map. // To reduce the cost of adding extra collision circles, we slowly increase // them for overscaled tiles. - const float overscalingPaddingFactor = 1 + .4 * ::log2(static_cast<double>(overscaling)); + const float overscalingPaddingFactor = 1 + .4 * util::log2(static_cast<double>(overscaling)); const int nPitchPaddingBoxes = std::floor(nBoxes * overscalingPaddingFactor / 2); // offset the center of the first box by half a box so that the edge of the diff --git a/src/mbgl/util/dtoa.hpp b/src/mbgl/util/dtoa.hpp index 4cb81a94be..e6b1659aa2 100644 --- a/src/mbgl/util/dtoa.hpp +++ b/src/mbgl/util/dtoa.hpp @@ -1,11 +1,16 @@ #pragma once #include <string> +#include <cstdlib> namespace mbgl { namespace util { std::string dtoa(double value); +inline double stod(const std::string& str) { + return ::strtod(str.c_str(), nullptr); +} + } // end namespace util } // end namespace mbgl diff --git a/src/mbgl/util/tile_cover.cpp b/src/mbgl/util/tile_cover.cpp index f58d1270bd..7979c550a9 100644 --- a/src/mbgl/util/tile_cover.cpp +++ b/src/mbgl/util/tile_cover.cpp @@ -131,7 +131,7 @@ std::vector<UnwrappedTileID> tileCover(const Point<double>& tl, } // namespace int32_t coveringZoomLevel(double zoom, style::SourceType type, uint16_t size) { - zoom += ::log2(util::tileSize / size); + zoom += util::log2(util::tileSize / size); if (type == style::SourceType::Raster || type == style::SourceType::Video) { return ::round(zoom); } else { |