From 520eddb794e616490c0e58c2f210f338537be82b Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Fri, 29 May 2015 11:51:10 -0400 Subject: [PATCH] use floats when resampling lines to match -js This fixes many small render test and collision differences. --- src/mbgl/text/get_anchors.cpp | 6 +++--- styles | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mbgl/text/get_anchors.cpp b/src/mbgl/text/get_anchors.cpp index c5aa6e962..88c09983a 100644 --- a/src/mbgl/text/get_anchors.cpp +++ b/src/mbgl/text/get_anchors.cpp @@ -28,11 +28,11 @@ Anchors resample(const std::vector &line, const float offset, const markedDistance += spacing; float t = (markedDistance - distance) / segmentDist, - x = util::interpolate(a.x, b.x, t), - y = util::interpolate(a.y, b.y, t); + x = util::interpolate(float(a.x), float(b.x), t), + y = util::interpolate(float(a.y), float(b.y), t); if (x >= 0 && x < 4096 && y >= 0 && y < 4096) { - Anchor anchor(x, y, angle, 0.5f, i); + Anchor anchor(std::round(x), std::round(y), angle, 0.5f, i); if (!angleWindowSize || checkMaxAngle(line, anchor, labelLength, angleWindowSize, maxAngle)) { anchors.push_back(anchor); diff --git a/styles b/styles index 93a23d762..86aecb8e9 160000 --- a/styles +++ b/styles @@ -1 +1 @@ -Subproject commit 93a23d762332a4c75e3dae1c547c4d810101e978 +Subproject commit 86aecb8e997c54c9d2bf6ac494fea132e375ad08