summaryrefslogtreecommitdiff
path: root/src/mbgl/text
diff options
context:
space:
mode:
authorAnand Thakker <anandthakker@users.noreply.github.com>2017-03-28 07:41:03 -0400
committerGitHub <noreply@github.com>2017-03-28 07:41:03 -0400
commit0abaae23b69eec1985bd256c6ee1cf50aabe2439 (patch)
tree90bc24f1580dd105b464a5b94937b1a594da57bf /src/mbgl/text
parentf9462adf8a68bcd5a4a82cf368faeb2c40d30cc4 (diff)
downloadqtlocation-mapboxgl-0abaae23b69eec1985bd256c6ee1cf50aabe2439.tar.gz
Small edit to improve code resiliency (#8540)
h/t @ChrisLoer catching this place where we were relying on member initialization order. While it _happened_ to be okay here, it's unnecessarily fragile.
Diffstat (limited to 'src/mbgl/text')
-rw-r--r--src/mbgl/text/quads.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mbgl/text/quads.cpp b/src/mbgl/text/quads.cpp
index 9427362081..b13a6a71e5 100644
--- a/src/mbgl/text/quads.cpp
+++ b/src/mbgl/text/quads.cpp
@@ -252,11 +252,12 @@ void getLineGlyphs(std::back_insert_iterator<GlyphInstances> glyphs,
const bool glyphIsLogicallyForward = (glyphHorizontalOffsetFromAnchor >= 0) ^ upsideDown;
const float glyphDistanceFromAnchor = std::fabs(glyphHorizontalOffsetFromAnchor);
+ const auto initialSegmentEnd = getSegmentEnd(glyphIsLogicallyForward, line, anchorSegment);
VirtualSegment virtualSegment = {
anchor.point,
- getSegmentEnd(glyphIsLogicallyForward, line, anchorSegment),
+ initialSegmentEnd,
anchorSegment,
- getMinScaleForSegment(glyphDistanceFromAnchor, virtualSegment.anchor, virtualSegment.end),
+ getMinScaleForSegment(glyphDistanceFromAnchor, anchor.point, initialSegmentEnd),
std::numeric_limits<float>::infinity()
};