diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-26 12:42:17 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-26 16:29:44 -0700 |
commit | 1c42daa152c1e7302c0997c00e206cf7c4b33d73 (patch) | |
tree | edc0115651ed5e2931c8362016d2e7da5928f3ea /src/mbgl/layout/symbol_layout.cpp | |
parent | ea0e45b4019ea18c03718e67a3397202080a644a (diff) | |
download | qtlocation-mapboxgl-1c42daa152c1e7302c0997c00e206cf7c4b33d73.tar.gz |
[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.
Diffstat (limited to 'src/mbgl/layout/symbol_layout.cpp')
-rw-r--r-- | src/mbgl/layout/symbol_layout.cpp | 31 |
1 files changed, 13 insertions, 18 deletions
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<const RenderLayer*>& 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<RenderSymbolLayer>()->impl->layout.unevaluated.get<TextSize>()), @@ -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<IconOffset>(zoom, feature), - layout.evaluate<IconRotate>(zoom, feature) * util::DEG2RAD); - if (image->second.sdf) { - sdfIcons = true; - } - if (image->second.relativePixelRatio != 1.0f) { - iconsNeedLinear = true; - } else if (layout.get<IconRotate>().constantOr(1) != 0) { - iconsNeedLinear = true; - } + auto image = icons.find(*feature.icon); + if (image != icons.end()) { + shapedIcon = PositionedIcon::shapeIcon(image->second, + layout.evaluate<IconOffset>(zoom, feature), + layout.evaluate<IconRotate>(zoom, feature) * util::DEG2RAD); + if (image->second.sdf) { + sdfIcons = true; + } + if (image->second.relativePixelRatio != 1.0f) { + iconsNeedLinear = true; + } else if (layout.get<IconRotate>().constantOr(1) != 0) { + iconsNeedLinear = true; } } } |