summaryrefslogtreecommitdiff
path: root/src/mbgl/tile/geometry_tile.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-04-26 12:42:17 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-04-26 16:29:44 -0700
commit1c42daa152c1e7302c0997c00e206cf7c4b33d73 (patch)
treeedc0115651ed5e2931c8362016d2e7da5928f3ea /src/mbgl/tile/geometry_tile.cpp
parentea0e45b4019ea18c03718e67a3397202080a644a (diff)
downloadqtlocation-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/tile/geometry_tile.cpp')
-rw-r--r--src/mbgl/tile/geometry_tile.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/mbgl/tile/geometry_tile.cpp b/src/mbgl/tile/geometry_tile.cpp
index b47519d95c..6b768d9d5b 100644
--- a/src/mbgl/tile/geometry_tile.cpp
+++ b/src/mbgl/tile/geometry_tile.cpp
@@ -9,6 +9,7 @@
#include <mbgl/renderer/render_background_layer.hpp>
#include <mbgl/renderer/render_custom_layer.hpp>
#include <mbgl/renderer/render_symbol_layer.hpp>
+#include <mbgl/renderer/symbol_bucket.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/storage/file_source.hpp>
#include <mbgl/geometry/feature_index.hpp>
@@ -28,7 +29,9 @@ using namespace style;
GeometryTile::GeometryTile(const OverscaledTileID& id_,
std::string sourceID_,
- const style::UpdateParameters& parameters)
+ const style::UpdateParameters& parameters,
+ GlyphAtlas& glyphAtlas_,
+ SpriteAtlas& spriteAtlas_)
: Tile(id_),
sourceID(std::move(sourceID_)),
style(parameters.style),
@@ -38,14 +41,13 @@ GeometryTile::GeometryTile(const OverscaledTileID& id_,
id_,
obsolete,
parameters.mode),
- glyphAtlas(*parameters.style.glyphAtlas) {
+ glyphAtlas(glyphAtlas_),
+ spriteAtlas(spriteAtlas_) {
}
GeometryTile::~GeometryTile() {
glyphAtlas.removeGlyphs(*this);
- for (auto spriteAtlas : pendingSpriteAtlases) {
- spriteAtlas->removeRequestor(*this);
- }
+ spriteAtlas.removeRequestor(*this);
cancel();
}
@@ -125,6 +127,9 @@ void GeometryTile::onPlacement(PlacementResult result) {
pending = false;
}
symbolBuckets = std::move(result.symbolBuckets);
+ for (auto& entry : symbolBuckets) {
+ dynamic_cast<SymbolBucket*>(entry.second.get())->spriteAtlas = &spriteAtlas;
+ }
collisionTile = std::move(result.collisionTile);
observer->onTileChanged(*this);
}
@@ -144,21 +149,12 @@ void GeometryTile::getGlyphs(GlyphDependencies glyphDependencies) {
glyphAtlas.getGlyphs(*this, std::move(glyphDependencies));
}
-void GeometryTile::onIconsAvailable(SpriteAtlas* spriteAtlas, IconMap icons) {
- iconAtlasMap[(uintptr_t)spriteAtlas] = icons;
- pendingSpriteAtlases.erase(spriteAtlas);
- if (pendingSpriteAtlases.empty()) {
- worker.invoke(&GeometryTileWorker::onIconsAvailable, std::move(iconAtlasMap));
- }
+void GeometryTile::onIconsAvailable(IconMap icons) {
+ worker.invoke(&GeometryTileWorker::onIconsAvailable, std::move(icons));
}
-// TODO: If there's any value to be gained by it, we can narrow our request to just the sprites
-// we need, but SpriteAtlases are just "loaded" or "not loaded"
-void GeometryTile::getIcons(IconDependencyMap iconDependencyMap) {
- for (auto dependency : iconDependencyMap) {
- pendingSpriteAtlases.insert(dependency.first);
- dependency.first->getIcons(*this);
- }
+void GeometryTile::getIcons(IconDependencies) {
+ spriteAtlas.getIcons(*this);
}
Bucket* GeometryTile::getBucket(const RenderLayer& layer) const {