summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2014-11-21 15:54:14 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2014-11-26 15:13:13 -0800
commit8c3e39a5167991e628db981e73eb39f69dd4f86a (patch)
tree05e6d938288f154dda02bc0b882b34ab24e57ef0
parent8e33076bf116584b1ed0b9bdafdff2f0438afc26 (diff)
downloadqtlocation-mapboxgl-8c3e39a5167991e628db981e73eb39f69dd4f86a.tar.gz
Eliminate Map::getGlyphStore()
-rw-r--r--include/mbgl/map/map.hpp1
-rw-r--r--include/mbgl/map/source.hpp7
-rw-r--r--include/mbgl/map/tile_parser.hpp4
-rw-r--r--include/mbgl/map/vector_tile_data.hpp5
-rw-r--r--src/map/map.cpp2
-rw-r--r--src/map/source.cpp19
-rw-r--r--src/map/tile_parser.cpp5
-rw-r--r--src/map/vector_tile_data.cpp9
8 files changed, 32 insertions, 20 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index 635ac4d222..fca3619c0c 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -127,7 +127,6 @@ public:
public:
inline const TransformState &getState() const { return state; }
inline util::ptr<Style> getStyle() const { return style; }
- inline util::ptr<GlyphStore> getGlyphStore() { return glyphStore; }
util::ptr<Sprite> getSprite();
inline util::ptr<Texturepool> getTexturepool() { return texturepool; }
uv::worker &getWorker();
diff --git a/include/mbgl/map/source.hpp b/include/mbgl/map/source.hpp
index 2094ff0828..b515d26f0a 100644
--- a/include/mbgl/map/source.hpp
+++ b/include/mbgl/map/source.hpp
@@ -19,6 +19,7 @@ namespace mbgl {
class Map;
class GlyphAtlas;
+class GlyphStore;
class SpriteAtlas;
class FileSource;
class Painter;
@@ -31,7 +32,7 @@ public:
Source(const util::ptr<SourceInfo>& info);
void load(Map&, FileSource&);
- bool update(Map&, GlyphAtlas&, SpriteAtlas&, FileSource&);
+ bool update(Map&, GlyphAtlas&, GlyphStore&, SpriteAtlas&, FileSource&);
void updateMatrices(const mat4 &projMatrix, const TransformState &transform);
void drawClippingMasks(Painter &painter);
@@ -50,9 +51,9 @@ private:
int32_t coveringZoomLevel(const TransformState&) const;
std::forward_list<Tile::ID> coveringTiles(const TransformState&) const;
- bool updateTiles(Map&, GlyphAtlas&, SpriteAtlas&, FileSource&);
+ bool updateTiles(Map&, GlyphAtlas&, GlyphStore&, SpriteAtlas&, FileSource&);
- TileData::State addTile(Map&, GlyphAtlas&, SpriteAtlas&, FileSource&, const Tile::ID&);
+ TileData::State addTile(Map&, GlyphAtlas&, GlyphStore&, SpriteAtlas&, FileSource&, const Tile::ID&);
TileData::State hasTile(const Tile::ID& id);
double getZoom(const TransformState &state) const;
diff --git a/include/mbgl/map/tile_parser.hpp b/include/mbgl/map/tile_parser.hpp
index 576c18ec94..5e8aa4fc36 100644
--- a/include/mbgl/map/tile_parser.hpp
+++ b/include/mbgl/map/tile_parser.hpp
@@ -35,7 +35,7 @@ public:
TileParser(const std::string &data, VectorTileData &tile,
const util::ptr<const Style> &style,
GlyphAtlas & glyphAtlas,
- const util::ptr<GlyphStore> &glyphStore,
+ GlyphStore & glyphStore,
SpriteAtlas & spriteAtlas,
const util::ptr<Sprite> &sprite);
~TileParser();
@@ -62,7 +62,7 @@ private:
// Cross-thread shared data.
util::ptr<const Style> style;
GlyphAtlas & glyphAtlas;
- util::ptr<GlyphStore> glyphStore;
+ GlyphStore & glyphStore;
SpriteAtlas & spriteAtlas;
util::ptr<Sprite> sprite;
util::ptr<Texturepool> texturePool;
diff --git a/include/mbgl/map/vector_tile_data.hpp b/include/mbgl/map/vector_tile_data.hpp
index 793aa61581..59846fcaae 100644
--- a/include/mbgl/map/vector_tile_data.hpp
+++ b/include/mbgl/map/vector_tile_data.hpp
@@ -22,6 +22,7 @@ class SourceInfo;
class StyleLayer;
class TileParser;
class GlyphAtlas;
+class GlyphStore;
class SpriteAtlas;
class VectorTileData : public TileData {
@@ -29,7 +30,8 @@ class VectorTileData : public TileData {
public:
VectorTileData(Tile::ID const&, Map&,
- GlyphAtlas&, SpriteAtlas&,
+ GlyphAtlas&, GlyphStore&,
+ SpriteAtlas&,
const util::ptr<SourceInfo>&);
~VectorTileData();
@@ -53,6 +55,7 @@ protected:
std::unordered_map<std::string, std::unique_ptr<Bucket>> buckets;
GlyphAtlas& glyphAtlas;
+ GlyphStore& glyphStore;
SpriteAtlas& spriteAtlas;
public:
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 355a36c56d..fbfc6abd3a 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -642,7 +642,7 @@ void Map::updateSources(const util::ptr<StyleLayerGroup> &group) {
void Map::updateTiles() {
for (const util::ptr<StyleSource> &source : getActiveSources()) {
- source->source->update(*this, glyphAtlas, spriteAtlas, *fileSource);
+ source->source->update(*this, glyphAtlas, *glyphStore, spriteAtlas, *fileSource);
}
}
diff --git a/src/map/source.cpp b/src/map/source.cpp
index 6b1ab2a403..b11b9dd460 100644
--- a/src/map/source.cpp
+++ b/src/map/source.cpp
@@ -61,9 +61,11 @@ void Source::load(Map& map, FileSource& fileSource) {
});
}
-bool Source::update(Map& map, GlyphAtlas& glyphAtlas, SpriteAtlas& spriteAtlas, FileSource& fileSource) {
+bool Source::update(Map& map,
+ GlyphAtlas& glyphAtlas, GlyphStore& glyphStore,
+ SpriteAtlas& spriteAtlas, FileSource& fileSource) {
if (loaded && map.getTime() > updated) {
- return updateTiles(map, glyphAtlas, spriteAtlas, fileSource);
+ return updateTiles(map, glyphAtlas, glyphStore, spriteAtlas, fileSource);
} else {
return false;
}
@@ -159,7 +161,10 @@ TileData::State Source::hasTile(const Tile::ID& id) {
return TileData::State::invalid;
}
-TileData::State Source::addTile(Map& map, GlyphAtlas& glyphAtlas, SpriteAtlas& spriteAtlas, FileSource& fileSource, const Tile::ID& id) {
+TileData::State Source::addTile(Map& map,
+ GlyphAtlas& glyphAtlas, GlyphStore& glyphStore,
+ SpriteAtlas& spriteAtlas,
+ FileSource& fileSource, const Tile::ID& id) {
const TileData::State state = hasTile(id);
if (state != TileData::State::invalid) {
@@ -187,7 +192,7 @@ TileData::State Source::addTile(Map& map, GlyphAtlas& glyphAtlas, SpriteAtlas& s
if (!new_tile.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, map, glyphAtlas, spriteAtlas, info);
+ new_tile.data = std::make_shared<VectorTileData>(normalized_id, map, glyphAtlas, glyphStore, spriteAtlas, info);
} else if (info->type == SourceType::Raster) {
new_tile.data = std::make_shared<RasterTileData>(normalized_id, map, info);
} else {
@@ -281,7 +286,9 @@ bool Source::findLoadedParent(const Tile::ID& id, int32_t minCoveringZoom, std::
return false;
}
-bool Source::updateTiles(Map& map, GlyphAtlas& glyphAtlas, SpriteAtlas& spriteAtlas, FileSource& fileSource) {
+bool Source::updateTiles(Map& map,
+ GlyphAtlas& glyphAtlas, GlyphStore& glyphStore,
+ SpriteAtlas& spriteAtlas, FileSource& fileSource) {
bool changed = false;
int32_t zoom = std::floor(getZoom(map.getState()));
@@ -298,7 +305,7 @@ bool Source::updateTiles(Map& map, GlyphAtlas& glyphAtlas, SpriteAtlas& spriteAt
// Add existing child/parent tiles if the actual tile is not yet loaded
for (const Tile::ID& id : required) {
- const TileData::State state = addTile(map, glyphAtlas, spriteAtlas, fileSource, id);
+ const TileData::State state = addTile(map, glyphAtlas, glyphStore, spriteAtlas, fileSource, id);
if (state != TileData::State::parsed) {
// The tile we require is not yet loaded. Try to find a parent or
diff --git a/src/map/tile_parser.cpp b/src/map/tile_parser.cpp
index e707cde620..768b7da9fd 100644
--- a/src/map/tile_parser.cpp
+++ b/src/map/tile_parser.cpp
@@ -32,7 +32,7 @@ TileParser::~TileParser() = default;
TileParser::TileParser(const std::string &data, VectorTileData &tile_,
const util::ptr<const Style> &style_,
GlyphAtlas & glyphAtlas_,
- const util::ptr<GlyphStore> &glyphStore_,
+ GlyphStore & glyphStore_,
SpriteAtlas & spriteAtlas_,
const util::ptr<Sprite> &sprite_)
: vector_data(pbf((const uint8_t *)data.data(), data.size())),
@@ -45,7 +45,6 @@ TileParser::TileParser(const std::string &data, VectorTileData &tile_,
collision(std::make_unique<Collision>(tile.id.z, 4096, tile.source->tile_size, tile.depth)) {
assert(&tile != nullptr);
assert(style);
- assert(glyphStore);
assert(sprite);
assert(collision);
}
@@ -167,7 +166,7 @@ std::unique_ptr<Bucket> TileParser::createLineBucket(const VectorTileLayer& laye
std::unique_ptr<Bucket> TileParser::createSymbolBucket(const VectorTileLayer& layer, const FilterExpression &filter, const StyleBucketSymbol &symbol) {
std::unique_ptr<SymbolBucket> bucket = std::make_unique<SymbolBucket>(symbol, *collision);
- bucket->addFeatures(layer, filter, tile.id, spriteAtlas, *sprite, glyphAtlas, *glyphStore);
+ bucket->addFeatures(layer, filter, tile.id, spriteAtlas, *sprite, glyphAtlas, glyphStore);
return obsolete() ? nullptr : std::move(bucket);
}
diff --git a/src/map/vector_tile_data.cpp b/src/map/vector_tile_data.cpp
index 93b3e953cb..d2f73269c0 100644
--- a/src/map/vector_tile_data.cpp
+++ b/src/map/vector_tile_data.cpp
@@ -9,10 +9,12 @@
using namespace mbgl;
VectorTileData::VectorTileData(Tile::ID const& id_, Map &map_,
- GlyphAtlas& glyphAtlas_, SpriteAtlas& spriteAtlas_,
+ GlyphAtlas& glyphAtlas_, GlyphStore& glyphStore_,
+ SpriteAtlas& spriteAtlas_,
const util::ptr<SourceInfo> &source_)
: TileData(id_, map_, source_),
glyphAtlas(glyphAtlas_),
+ glyphStore(glyphStore_),
spriteAtlas(spriteAtlas_),
depth(id.z >= source->max_zoom ? map.getMaxZoom() - id.z : 1) {
}
@@ -31,8 +33,9 @@ void VectorTileData::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(data, *this, map.getStyle(), glyphAtlas,
- map.getGlyphStore(), spriteAtlas, map.getSprite());
+ TileParser parser(data, *this, map.getStyle(),
+ glyphAtlas, glyphStore,
+ spriteAtlas, map.getSprite());
parser.parse();
} catch (const std::exception& ex) {
#if defined(DEBUG)