From 1c42daa152c1e7302c0997c00e206cf7c4b33d73 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Wed, 26 Apr 2017 12:42:17 -0700 Subject: [core] Tweak handling of annotation special case SpriteAtlas * Simplify SymbolLayout; it never needs to care about more than one SpriteAtlas. * Move the reference from SymbolLayer::Impl to SymbolBucket. This is a prerequisite for making layer Impls immutable. --- src/mbgl/layout/symbol_layout.cpp | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'src/mbgl/layout/symbol_layout.cpp') diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp index 9aca316a00..aa91eb1688 100644 --- a/src/mbgl/layout/symbol_layout.cpp +++ b/src/mbgl/layout/symbol_layout.cpp @@ -42,14 +42,12 @@ SymbolLayout::SymbolLayout(const BucketParameters& parameters, const std::vector& layers, const GeometryTileLayer& sourceLayer, IconDependencies& iconDependencies, - uintptr_t _spriteAtlasMapIndex, GlyphDependencies& glyphDependencies) : sourceLayerName(sourceLayer.getName()), bucketName(layers.at(0)->getID()), overscaling(parameters.tileID.overscaleFactor()), zoom(parameters.tileID.overscaledZ), mode(parameters.mode), - spriteAtlasMapIndex(_spriteAtlasMapIndex), tileSize(util::tileSize * overscaling), tilePixelRatio(float(util::EXTENT) / tileSize), textSize(layers.at(0)->as()->impl->layout.unevaluated.get()), @@ -171,7 +169,7 @@ bool SymbolLayout::hasSymbolInstances() const { return !symbolInstances.empty(); } -void SymbolLayout::prepare(const GlyphPositionMap& glyphs, const IconAtlasMap& iconMap) { +void SymbolLayout::prepare(const GlyphPositionMap& glyphs, const IconMap& icons) { float horizontalAlign = 0.5; float verticalAlign = 0.5; @@ -259,21 +257,18 @@ void SymbolLayout::prepare(const GlyphPositionMap& glyphs, const IconAtlasMap& i // if feature has icon, get sprite atlas position if (feature.icon) { - auto icons = iconMap.find(spriteAtlasMapIndex); - if (icons != iconMap.end()) { - auto image = icons->second.find(*feature.icon); - if (image != icons->second.end()) { - shapedIcon = PositionedIcon::shapeIcon(image->second, - layout.evaluate(zoom, feature), - layout.evaluate(zoom, feature) * util::DEG2RAD); - if (image->second.sdf) { - sdfIcons = true; - } - if (image->second.relativePixelRatio != 1.0f) { - iconsNeedLinear = true; - } else if (layout.get().constantOr(1) != 0) { - iconsNeedLinear = true; - } + auto image = icons.find(*feature.icon); + if (image != icons.end()) { + shapedIcon = PositionedIcon::shapeIcon(image->second, + layout.evaluate(zoom, feature), + layout.evaluate(zoom, feature) * util::DEG2RAD); + if (image->second.sdf) { + sdfIcons = true; + } + if (image->second.relativePixelRatio != 1.0f) { + iconsNeedLinear = true; + } else if (layout.get().constantOr(1) != 0) { + iconsNeedLinear = true; } } } -- cgit v1.2.1