summaryrefslogtreecommitdiff
path: root/src/mbgl/layout/symbol_layout.cpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-04-11 20:31:18 +0300
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-04-14 12:33:13 -0700
commit98e2e59e5e963dbc5451a19233d942b429a74855 (patch)
tree2eb68e34823d07a7402e0c633e4c3e9510b76b4c /src/mbgl/layout/symbol_layout.cpp
parent2f4d162debd7e4accfc0b20360058304dce40801 (diff)
downloadqtlocation-mapboxgl-98e2e59e5e963dbc5451a19233d942b429a74855.tar.gz
[core] Safeguard PositionedIcon usage via optional
Diffstat (limited to 'src/mbgl/layout/symbol_layout.cpp')
-rw-r--r--src/mbgl/layout/symbol_layout.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp
index 907e60a598..0b05d4f5e1 100644
--- a/src/mbgl/layout/symbol_layout.cpp
+++ b/src/mbgl/layout/symbol_layout.cpp
@@ -221,7 +221,7 @@ void SymbolLayout::prepare(const GlyphPositionMap& glyphs, const IconAtlasMap& i
if (feature.geometry.empty()) continue;
std::pair<Shaping, Shaping> shapedTextOrientations;
- PositionedIcon shapedIcon;
+ optional<PositionedIcon> shapedIcon;
GlyphPositions face;
// if feature has text, shape the text
@@ -262,7 +262,7 @@ void SymbolLayout::prepare(const GlyphPositionMap& glyphs, const IconAtlasMap& i
if (icons != iconMap.end()) {
auto image = icons->second.find(*feature.icon);
if (image != icons->second.end()) {
- shapedIcon = shapeIcon(image->second,
+ shapedIcon = PositionedIcon::shapeIcon(image->second,
layout.evaluate<IconOffset>(zoom, feature),
layout.evaluate<IconRotate>(zoom, feature) * util::DEG2RAD);
if (image->second.sdf) {
@@ -292,7 +292,7 @@ void SymbolLayout::prepare(const GlyphPositionMap& glyphs, const IconAtlasMap& i
void SymbolLayout::addFeature(const std::size_t index,
const SymbolFeature& feature,
const std::pair<Shaping, Shaping>& shapedTextOrientations,
- const PositionedIcon& shapedIcon,
+ optional<PositionedIcon> shapedIcon,
const GlyphPositions& glyphs) {
const float minScale = 0.5f;
const float glyphSize = 24.0f;
@@ -363,8 +363,8 @@ void SymbolLayout::addFeature(const std::size_t index,
textMaxAngle,
(shapedTextOrientations.second ?: shapedTextOrientations.first).left,
(shapedTextOrientations.second ?: shapedTextOrientations.first).right,
- shapedIcon.left,
- shapedIcon.right,
+ (shapedIcon ? shapedIcon->left() : 0),
+ (shapedIcon ? shapedIcon->right() : 0),
glyphSize,
textMaxBoxScale,
overscaling);