diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2015-10-23 11:00:24 -0700 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2015-10-23 11:00:52 -0700 |
commit | 46e2f13e683048ea206110cb2b6f0af36db2782f (patch) | |
tree | 93f9638b610fe5c60e1b979d0d287535146c92cf /src/mbgl/annotation/shape_annotation_impl.cpp | |
parent | 224e40597679a8cbbe4597981e9a330c0794eb92 (diff) | |
download | qtlocation-mapboxgl-46e2f13e683048ea206110cb2b6f0af36db2782f.tar.gz |
[core] Fix integer overflow for high maximum zoom levels
Diffstat (limited to 'src/mbgl/annotation/shape_annotation_impl.cpp')
-rw-r--r-- | src/mbgl/annotation/shape_annotation_impl.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp index 4ab9958fdf..4f1863874e 100644 --- a/src/mbgl/annotation/shape_annotation_impl.cpp +++ b/src/mbgl/annotation/shape_annotation_impl.cpp @@ -96,10 +96,12 @@ std::unique_ptr<StyleLayer> ShapeAnnotationImpl::createFillLayer() { } void ShapeAnnotationImpl::updateTile(const TileID& tileID, AnnotationTile& tile) { + static const double baseTolerance = 3; + static const uint16_t extent = 4096; + if (!shapeTiler) { - const double baseTolerance = 3; - const uint16_t extent = 4096; - const double tolerance = baseTolerance / ((1 << maxZoom) * extent); + const uint64_t maxAmountOfTiles = 1 << maxZoom; + const double tolerance = baseTolerance / (maxAmountOfTiles * extent); ProjectedGeometryContainer rings; std::vector<LonLat> points; |