Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] fix infinite loop in mbgl::resample
Browse files Browse the repository at this point in the history
fix #4416
  • Loading branch information
ansis committed Mar 29, 2016
1 parent 6fcc7ba commit 0539f7b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"devDependencies": {
"aws-sdk": "^2.2.21",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#a42cd0cb818356d91fc6b61e2b64801e57486ac0",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#45066f6e78c780211d9587df2352597e07a197b5",
"node-gyp": "^3.2.1",
"request": "^2.67.0",
"tape": "^4.2.2"
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/renderer/line_bucket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void LineBucket::addGeometry(const GeometryCoordinates& vertices) {

const float miterLimit = layout.join == JoinType::Bevel ? 1.05f : float(layout.miterLimit);

const double sharpCornerOffset = SHARP_CORNER_OFFSET * (util::EXTENT / (util::tileSize * overscaling));
const double sharpCornerOffset = SHARP_CORNER_OFFSET * (float(util::EXTENT) / (util::tileSize * overscaling));

const GeometryCoordinate firstVertex = vertices.front();
const GeometryCoordinate lastVertex = vertices[len - 1];
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/renderer/symbol_bucket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ SymbolBucket::SymbolBucket(uint32_t overscaling_, float zoom_, const MapMode mod
: overscaling(overscaling_),
zoom(zoom_),
tileSize(util::tileSize * overscaling_),
tilePixelRatio(util::EXTENT / tileSize),
tilePixelRatio(float(util::EXTENT) / tileSize),
mode(mode_) {}

SymbolBucket::~SymbolBucket() {
Expand Down
3 changes: 3 additions & 0 deletions src/mbgl/text/get_anchors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <mbgl/util/constants.hpp>
#include <mbgl/util/interpolate.hpp>

#include <cassert>
#include <cmath>

namespace mbgl {
Expand All @@ -21,6 +22,8 @@ Anchors resample(const GeometryCoordinates &line, const float offset, const floa

Anchors anchors;

assert(spacing > 0.0);

int i = 0;
for (auto it = line.begin(), end = line.end() - 1; it != end; it++, i++) {
const GeometryCoordinate &a = *(it);
Expand Down

0 comments on commit 0539f7b

Please sign in to comment.