diff options
author | Chris Loer <chris.loer@gmail.com> | 2017-03-31 14:53:18 -0700 |
---|---|---|
committer | Chris Loer <chris.loer@mapbox.com> | 2017-04-04 11:33:12 -0700 |
commit | 5cdf838a387cae446dba500ac49a1c5524bf7949 (patch) | |
tree | 3b438034a7842c36a7804096785fca1a6ad6fa80 /src/mbgl/style | |
parent | 64beba3accb0f2088b2e01fad710f915c81d99c7 (diff) | |
download | qtlocation-mapboxgl-5cdf838a387cae446dba500ac49a1c5524bf7949.tar.gz |
[core] De-mutex GlyphAtlas and SpriteAtlas
- Expose glyph and icon information to workers via message interface.
- Glyph/SpriteAtlas track which tiles have outstanding requests
and send messages to them when glyphs/icons become available.
- Remove obsolete "updateSymbolDependentTiles" pathway
- Symbol preparation for a tile now depends on all glyphs becoming
available before it can start.
- Start tracking individual icons needed for a tile, although we don't
do anything with the information yet.
- Introduce typedef for GlyphID
Diffstat (limited to 'src/mbgl/style')
-rw-r--r-- | src/mbgl/style/layers/symbol_layer_impl.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/style/layers/symbol_layer_impl.hpp | 5 | ||||
-rw-r--r-- | src/mbgl/style/source_impl.cpp | 6 | ||||
-rw-r--r-- | src/mbgl/style/source_impl.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/style/style.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/style/style.hpp | 1 |
6 files changed, 9 insertions, 23 deletions
diff --git a/src/mbgl/style/layers/symbol_layer_impl.cpp b/src/mbgl/style/layers/symbol_layer_impl.cpp index e4557c953f..c637770c04 100644 --- a/src/mbgl/style/layers/symbol_layer_impl.cpp +++ b/src/mbgl/style/layers/symbol_layer_impl.cpp @@ -36,11 +36,15 @@ std::unique_ptr<Bucket> SymbolLayer::Impl::createBucket(const BucketParameters&, std::unique_ptr<SymbolLayout> SymbolLayer::Impl::createLayout(const BucketParameters& parameters, const std::vector<const Layer*>& group, - const GeometryTileLayer& layer) const { + const GeometryTileLayer& layer, + GlyphDependencies& glyphDependencies, + IconDependencyMap& iconDependencyMap) const { return std::make_unique<SymbolLayout>(parameters, group, layer, - *spriteAtlas); + iconDependencyMap[spriteAtlas], + (uintptr_t)spriteAtlas, + glyphDependencies); } IconPaintProperties::Evaluated SymbolLayer::Impl::iconPaintProperties() const { diff --git a/src/mbgl/style/layers/symbol_layer_impl.hpp b/src/mbgl/style/layers/symbol_layer_impl.hpp index 0c4b74e833..db20989f01 100644 --- a/src/mbgl/style/layers/symbol_layer_impl.hpp +++ b/src/mbgl/style/layers/symbol_layer_impl.hpp @@ -1,13 +1,14 @@ #pragma once +#include <mbgl/text/glyph.hpp> #include <mbgl/util/variant.hpp> +#include <mbgl/sprite/sprite_atlas.hpp> #include <mbgl/style/layer_impl.hpp> #include <mbgl/style/layers/symbol_layer.hpp> #include <mbgl/style/layers/symbol_layer_properties.hpp> namespace mbgl { -class SpriteAtlas; class SymbolLayout; namespace style { @@ -67,7 +68,7 @@ public: std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const Layer*>&) const override; std::unique_ptr<SymbolLayout> createLayout(const BucketParameters&, const std::vector<const Layer*>&, - const GeometryTileLayer&) const; + const GeometryTileLayer&, GlyphDependencies&, IconDependencyMap&) const; IconPaintProperties::Evaluated iconPaintProperties() const; TextPaintProperties::Evaluated textPaintProperties() const; diff --git a/src/mbgl/style/source_impl.cpp b/src/mbgl/style/source_impl.cpp index 356d420e19..9fabc54f7d 100644 --- a/src/mbgl/style/source_impl.cpp +++ b/src/mbgl/style/source_impl.cpp @@ -191,12 +191,6 @@ void Source::Impl::removeTiles() { } } -void Source::Impl::updateSymbolDependentTiles() { - for (auto& pair : tiles) { - pair.second->symbolDependenciesChanged(); - } -} - void Source::Impl::reloadTiles() { cache.clear(); diff --git a/src/mbgl/style/source_impl.hpp b/src/mbgl/style/source_impl.hpp index b4941dc638..e8ba54b2b6 100644 --- a/src/mbgl/style/source_impl.hpp +++ b/src/mbgl/style/source_impl.hpp @@ -48,10 +48,6 @@ public: // trigger re-placement of existing complete tiles. void updateTiles(const UpdateParameters&); - // Called when icons or glyphs are loaded. Triggers further processing of tiles which - // were waiting on such dependencies. - void updateSymbolDependentTiles(); - // Removes all tiles (by putting them into the cache). void removeTiles(); diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp index 5f9983ae94..9640988402 100644 --- a/src/mbgl/style/style.cpp +++ b/src/mbgl/style/style.cpp @@ -274,12 +274,6 @@ void Style::updateTiles(const UpdateParameters& parameters) { } } -void Style::updateSymbolDependentTiles() { - for (const auto& source : sources) { - source->baseImpl->updateSymbolDependentTiles(); - } -} - void Style::relayout() { for (const auto& sourceID : updateBatch.sourceIDs) { Source* source = getSource(sourceID); @@ -575,7 +569,6 @@ void Style::setObserver(style::Observer* observer_) { void Style::onGlyphsLoaded(const FontStack& fontStack, const GlyphRange& glyphRange) { observer->onGlyphsLoaded(fontStack, glyphRange); - updateSymbolDependentTiles(); } void Style::onGlyphsError(const FontStack& fontStack, const GlyphRange& glyphRange, std::exception_ptr error) { @@ -626,7 +619,6 @@ void Style::onTileError(Source& source, const OverscaledTileID& tileID, std::exc void Style::onSpriteLoaded() { observer->onSpriteLoaded(); observer->onUpdate(Update::Repaint); // For *-pattern properties. - updateSymbolDependentTiles(); } void Style::onSpriteError(std::exception_ptr error) { diff --git a/src/mbgl/style/style.hpp b/src/mbgl/style/style.hpp index 0c65129422..817cab5fd5 100644 --- a/src/mbgl/style/style.hpp +++ b/src/mbgl/style/style.hpp @@ -128,7 +128,6 @@ private: std::vector<std::unique_ptr<Layer>>::const_iterator findLayer(const std::string& layerID) const; void reloadLayerSource(Layer&); - void updateSymbolDependentTiles(); // GlyphStoreObserver implementation. void onGlyphsLoaded(const FontStack&, const GlyphRange&) override; |