diff options
Diffstat (limited to 'src/mbgl')
-rw-r--r-- | src/mbgl/map/live_tile_data.cpp | 9 | ||||
-rw-r--r-- | src/mbgl/map/live_tile_data.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/map/source.cpp | 17 | ||||
-rw-r--r-- | src/mbgl/map/source.hpp | 12 | ||||
-rw-r--r-- | src/mbgl/map/tile_parser.cpp | 16 | ||||
-rw-r--r-- | src/mbgl/map/tile_parser.hpp | 18 | ||||
-rw-r--r-- | src/mbgl/map/vector_tile_data.cpp | 12 | ||||
-rw-r--r-- | src/mbgl/map/vector_tile_data.hpp | 12 | ||||
-rw-r--r-- | src/mbgl/style/style.cpp | 3 |
9 files changed, 14 insertions, 89 deletions
diff --git a/src/mbgl/map/live_tile_data.cpp b/src/mbgl/map/live_tile_data.cpp index 4935c01345..4a90ea786c 100644 --- a/src/mbgl/map/live_tile_data.cpp +++ b/src/mbgl/map/live_tile_data.cpp @@ -11,15 +11,10 @@ using namespace mbgl; LiveTileData::LiveTileData(const TileID& id_, AnnotationManager& annotationManager_, Style& style_, - GlyphAtlas& glyphAtlas_, - GlyphStore& glyphStore_, - SpriteAtlas& spriteAtlas_, - util::ptr<Sprite> sprite_, const SourceInfo& source_, float angle_, bool collisionDebug_) - : VectorTileData::VectorTileData(id_, style_, glyphAtlas_, glyphStore_, - spriteAtlas_, sprite_, source_, angle_, collisionDebug_), + : VectorTileData::VectorTileData(id_, style_, source_, angle_, collisionDebug_), annotationManager(annotationManager_) { // live features are always ready setState(State::loaded); @@ -43,7 +38,7 @@ void LiveTileData::parse() { // Parsing creates state that is encapsulated in TileParser. While parsing, // the TileParser object writes results into this objects. All other state // is going to be discarded afterwards. - TileParser parser(*tile, *this, style, glyphAtlas, glyphStore, spriteAtlas, sprite); + TileParser parser(*tile, *this, style); parser.parse(); } catch (const std::exception& ex) { Log::Error(Event::ParseTile, "Live-parsing [%d/%d/%d] failed: %s", id.z, id.x, id.y, ex.what()); diff --git a/src/mbgl/map/live_tile_data.hpp b/src/mbgl/map/live_tile_data.hpp index 1620671230..f4f5412089 100644 --- a/src/mbgl/map/live_tile_data.hpp +++ b/src/mbgl/map/live_tile_data.hpp @@ -12,10 +12,6 @@ public: LiveTileData(const TileID&, AnnotationManager&, Style&, - GlyphAtlas&, - GlyphStore&, - SpriteAtlas&, - util::ptr<Sprite>, const SourceInfo&, float angle_, bool collisionDebug_); diff --git a/src/mbgl/map/source.cpp b/src/mbgl/map/source.cpp index 7dd91804b5..0bac4c3c7f 100644 --- a/src/mbgl/map/source.cpp +++ b/src/mbgl/map/source.cpp @@ -254,10 +254,6 @@ bool Source::handlePartialTile(const TileID& id, Worker& worker) { TileData::State Source::addTile(MapData& data, const TransformState& transformState, Style& style, - GlyphAtlas& glyphAtlas, - GlyphStore& glyphStore, - SpriteAtlas& spriteAtlas, - util::ptr<Sprite> sprite, TexturePool& texturePool, const TileID& id) { const TileData::State state = hasTile(id); @@ -295,8 +291,7 @@ TileData::State Source::addTile(MapData& data, // If we don't find working tile data, we're just going to load it. if (info.type == SourceType::Vector) { new_tile.data = - std::make_shared<VectorTileData>(normalized_id, style, glyphAtlas, - glyphStore, spriteAtlas, sprite, info, + std::make_shared<VectorTileData>(normalized_id, style, info, transformState.getAngle(), data.getCollisionDebug()); new_tile.data->request(style.workers, transformState.getPixelRatio(), callback); } else if (info.type == SourceType::Raster) { @@ -305,8 +300,7 @@ TileData::State Source::addTile(MapData& data, style.workers, transformState.getPixelRatio(), callback); } else if (info.type == SourceType::Annotations) { new_tile.data = std::make_shared<LiveTileData>(normalized_id, data.annotationManager, - style, glyphAtlas, - glyphStore, spriteAtlas, sprite, info, + style, info, transformState.getAngle(), data.getCollisionDebug()); new_tile.data->reparse(style.workers, callback); } else { @@ -405,10 +399,6 @@ bool Source::findLoadedParent(const TileID& id, int32_t minCoveringZoom, std::fo bool Source::update(MapData& data, const TransformState& transformState, Style& style, - GlyphAtlas& glyphAtlas, - GlyphStore& glyphStore, - SpriteAtlas& spriteAtlas, - util::ptr<Sprite> sprite, TexturePool& texturePool, bool shouldReparsePartialTiles) { bool allTilesUpdated = true; @@ -442,8 +432,7 @@ bool Source::update(MapData& data, } break; case TileData::State::invalid: - state = addTile(data, transformState, style, glyphAtlas, glyphStore, - spriteAtlas, sprite, texturePool, id); + state = addTile(data, transformState, style, texturePool, id); break; default: break; diff --git a/src/mbgl/map/source.hpp b/src/mbgl/map/source.hpp index 6b0b23f266..336caa5b93 100644 --- a/src/mbgl/map/source.hpp +++ b/src/mbgl/map/source.hpp @@ -22,10 +22,6 @@ namespace mbgl { class MapData; -class GlyphAtlas; -class GlyphStore; -class SpriteAtlas; -class Sprite; class TexturePool; class Style; class Painter; @@ -78,10 +74,6 @@ public: bool update(MapData&, const TransformState&, Style&, - GlyphAtlas&, - GlyphStore&, - SpriteAtlas&, - util::ptr<Sprite>, TexturePool&, bool shouldReparsePartialTiles); @@ -119,10 +111,6 @@ private: TileData::State addTile(MapData&, const TransformState&, Style&, - GlyphAtlas&, - GlyphStore&, - SpriteAtlas&, - util::ptr<Sprite>, TexturePool&, const TileID&); diff --git a/src/mbgl/map/tile_parser.cpp b/src/mbgl/map/tile_parser.cpp index 61af227034..56b34acdd2 100644 --- a/src/mbgl/map/tile_parser.cpp +++ b/src/mbgl/map/tile_parser.cpp @@ -21,20 +21,12 @@ TileParser::~TileParser() = default; TileParser::TileParser(const GeometryTile& geometryTile_, VectorTileData& tile_, - const Style& style_, - GlyphAtlas& glyphAtlas_, - GlyphStore& glyphStore_, - SpriteAtlas& spriteAtlas_, - const util::ptr<Sprite>& sprite_) + Style& style_) : geometryTile(geometryTile_), tile(tile_), style(style_), - glyphAtlas(glyphAtlas_), - glyphStore(glyphStore_), - spriteAtlas(spriteAtlas_), - sprite(sprite_), partialParse(false) { - assert(sprite); + assert(style.sprite); } bool TileParser::obsolete() const { @@ -222,7 +214,7 @@ std::unique_ptr<Bucket> TileParser::createSymbolBucket(const GeometryTileLayer& applyLayoutProperty(PropertyKey::TextOffset, bucket_desc.layout, layout.text.offset, z); applyLayoutProperty(PropertyKey::TextAllowOverlap, bucket_desc.layout, layout.text.allow_overlap, z); - if (bucket->needsDependencies(layer, bucket_desc.filter, glyphStore, *sprite)) { + if (bucket->needsDependencies(layer, bucket_desc.filter, *style.glyphStore, *style.sprite)) { partialParse = true; } @@ -235,7 +227,7 @@ std::unique_ptr<Bucket> TileParser::createSymbolBucket(const GeometryTileLayer& } bucket->addFeatures( - reinterpret_cast<uintptr_t>(&tile), spriteAtlas, *sprite, glyphAtlas, glyphStore); + reinterpret_cast<uintptr_t>(&tile), *style.spriteAtlas, *style.sprite, *style.glyphAtlas, *style.glyphStore); return bucket->hasData() ? std::move(bucket) : nullptr; } diff --git a/src/mbgl/map/tile_parser.hpp b/src/mbgl/map/tile_parser.hpp index 88e5687804..b716721a5d 100644 --- a/src/mbgl/map/tile_parser.hpp +++ b/src/mbgl/map/tile_parser.hpp @@ -18,10 +18,6 @@ namespace mbgl { class Bucket; class FontStack; -class GlyphAtlas; -class GlyphStore; -class SpriteAtlas; -class Sprite; class Style; class StyleBucket; class StyleLayoutFill; @@ -32,13 +28,7 @@ class VectorTileData; class TileParser : private util::noncopyable { public: - TileParser(const GeometryTile& geometryTile, - VectorTileData& tile, - const Style& style, - GlyphAtlas& glyphAtlas, - GlyphStore& glyphStore, - SpriteAtlas& spriteAtlas, - const util::ptr<Sprite>& sprite); + TileParser(const GeometryTile&, VectorTileData&, Style&); ~TileParser(); public: @@ -62,11 +52,7 @@ private: VectorTileData& tile; // Cross-thread shared data. - const Style& style; - GlyphAtlas& glyphAtlas; - GlyphStore& glyphStore; - SpriteAtlas& spriteAtlas; - util::ptr<Sprite> sprite; + Style& style; bool partialParse; }; diff --git a/src/mbgl/map/vector_tile_data.cpp b/src/mbgl/map/vector_tile_data.cpp index 6dc6e8e9b3..840e21b8ab 100644 --- a/src/mbgl/map/vector_tile_data.cpp +++ b/src/mbgl/map/vector_tile_data.cpp @@ -15,18 +15,10 @@ using namespace mbgl; VectorTileData::VectorTileData(const TileID& id_, Style& style_, - GlyphAtlas& glyphAtlas_, - GlyphStore& glyphStore_, - SpriteAtlas& spriteAtlas_, - util::ptr<Sprite> sprite_, const SourceInfo& source_, float angle, bool collisionDebug) : TileData(id_, source_), - glyphAtlas(glyphAtlas_), - glyphStore(glyphStore_), - spriteAtlas(spriteAtlas_), - sprite(sprite_), style(style_), collision(std::make_unique<CollisionTile>(id_.z, 4096, source_.tile_size * id.overscaling, angle, collisionDebug)), lastAngle(angle), @@ -37,7 +29,7 @@ VectorTileData::~VectorTileData() { // Cancel in most derived class destructor so that worker tasks are joined before // any member data goes away. cancel(); - glyphAtlas.removeGlyphs(reinterpret_cast<uintptr_t>(this)); + style.glyphAtlas->removeGlyphs(reinterpret_cast<uintptr_t>(this)); } void VectorTileData::parse() { @@ -51,7 +43,7 @@ void VectorTileData::parse() { // is going to be discarded afterwards. VectorTile vectorTile(pbf((const uint8_t *)data.data(), data.size())); const VectorTile* vt = &vectorTile; - TileParser parser(*vt, *this, style, glyphAtlas, glyphStore, spriteAtlas, sprite); + TileParser parser(*vt, *this, style); parser.parse(); if (getState() == State::obsolete) { diff --git a/src/mbgl/map/vector_tile_data.hpp b/src/mbgl/map/vector_tile_data.hpp index 5a6f448c69..697a054e09 100644 --- a/src/mbgl/map/vector_tile_data.hpp +++ b/src/mbgl/map/vector_tile_data.hpp @@ -22,10 +22,6 @@ class Painter; class SourceInfo; class StyleLayer; class TileParser; -class GlyphAtlas; -class GlyphStore; -class SpriteAtlas; -class Sprite; class Style; class VectorTileData : public TileData { @@ -34,10 +30,6 @@ class VectorTileData : public TileData { public: VectorTileData(const TileID&, Style&, - GlyphAtlas&, - GlyphStore&, - SpriteAtlas&, - util::ptr<Sprite>, const SourceInfo&, float angle_, bool collisionDebug_); @@ -66,10 +58,6 @@ protected: TriangleElementsBuffer triangleElementsBuffer; LineElementsBuffer lineElementsBuffer; - GlyphAtlas& glyphAtlas; - GlyphStore& glyphStore; - SpriteAtlas& spriteAtlas; - util::ptr<Sprite> sprite; Style& style; private: diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp index 15dffd113b..35a94adbc6 100644 --- a/src/mbgl/style/style.cpp +++ b/src/mbgl/style/style.cpp @@ -78,8 +78,7 @@ void Style::update(MapData& data, bool allTilesUpdated = true; for (const auto& source : sources) { - if (!source->update(data, transform, *this, *glyphAtlas, *glyphStore, - *spriteAtlas, sprite, texturePool, shouldReparsePartialTiles)) { + if (!source->update(data, transform, *this, texturePool, shouldReparsePartialTiles)) { allTilesUpdated = false; } } |