summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2014-11-21 15:47:35 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2014-11-26 15:13:13 -0800
commit8e33076bf116584b1ed0b9bdafdff2f0438afc26 (patch)
tree46208dbbafabae4595504e91dc0eab53a9063375 /src
parenta5fe8ec3dc138003e16bd39e15af899d78371d77 (diff)
downloadqtlocation-mapboxgl-8e33076bf116584b1ed0b9bdafdff2f0438afc26.tar.gz
Eliminate Map::getSpriteAtlas()
Diffstat (limited to 'src')
-rw-r--r--src/map/map.cpp2
-rw-r--r--src/map/source.cpp12
-rw-r--r--src/map/vector_tile_data.cpp7
3 files changed, 12 insertions, 9 deletions
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 22d0467336..355a36c56d 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, *fileSource);
+ source->source->update(*this, glyphAtlas, spriteAtlas, *fileSource);
}
}
diff --git a/src/map/source.cpp b/src/map/source.cpp
index 16a1116146..6b1ab2a403 100644
--- a/src/map/source.cpp
+++ b/src/map/source.cpp
@@ -61,9 +61,9 @@ void Source::load(Map& map, FileSource& fileSource) {
});
}
-bool Source::update(Map& map, GlyphAtlas& glyphAtlas, FileSource& fileSource) {
+bool Source::update(Map& map, GlyphAtlas& glyphAtlas, SpriteAtlas& spriteAtlas, FileSource& fileSource) {
if (loaded && map.getTime() > updated) {
- return updateTiles(map, glyphAtlas, fileSource);
+ return updateTiles(map, glyphAtlas, spriteAtlas, fileSource);
} else {
return false;
}
@@ -159,7 +159,7 @@ TileData::State Source::hasTile(const Tile::ID& id) {
return TileData::State::invalid;
}
-TileData::State Source::addTile(Map& map, GlyphAtlas& glyphAtlas, FileSource& fileSource, const Tile::ID& id) {
+TileData::State Source::addTile(Map& map, GlyphAtlas& glyphAtlas, SpriteAtlas& spriteAtlas, FileSource& fileSource, const Tile::ID& id) {
const TileData::State state = hasTile(id);
if (state != TileData::State::invalid) {
@@ -187,7 +187,7 @@ TileData::State Source::addTile(Map& map, GlyphAtlas& glyphAtlas, FileSource& fi
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, info);
+ new_tile.data = std::make_shared<VectorTileData>(normalized_id, map, glyphAtlas, spriteAtlas, info);
} else if (info->type == SourceType::Raster) {
new_tile.data = std::make_shared<RasterTileData>(normalized_id, map, info);
} else {
@@ -281,7 +281,7 @@ bool Source::findLoadedParent(const Tile::ID& id, int32_t minCoveringZoom, std::
return false;
}
-bool Source::updateTiles(Map& map, GlyphAtlas& glyphAtlas, FileSource& fileSource) {
+bool Source::updateTiles(Map& map, GlyphAtlas& glyphAtlas, SpriteAtlas& spriteAtlas, FileSource& fileSource) {
bool changed = false;
int32_t zoom = std::floor(getZoom(map.getState()));
@@ -298,7 +298,7 @@ bool Source::updateTiles(Map& map, GlyphAtlas& glyphAtlas, FileSource& fileSourc
// 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, fileSource, id);
+ const TileData::State state = addTile(map, glyphAtlas, 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/vector_tile_data.cpp b/src/map/vector_tile_data.cpp
index 6d2d25a35b..93b3e953cb 100644
--- a/src/map/vector_tile_data.cpp
+++ b/src/map/vector_tile_data.cpp
@@ -8,9 +8,12 @@
using namespace mbgl;
-VectorTileData::VectorTileData(Tile::ID const& id_, Map &map_, GlyphAtlas& glyphAtlas_, const util::ptr<SourceInfo> &source_)
+VectorTileData::VectorTileData(Tile::ID const& id_, Map &map_,
+ GlyphAtlas& glyphAtlas_, SpriteAtlas& spriteAtlas_,
+ const util::ptr<SourceInfo> &source_)
: TileData(id_, map_, source_),
glyphAtlas(glyphAtlas_),
+ spriteAtlas(spriteAtlas_),
depth(id.z >= source->max_zoom ? map.getMaxZoom() - id.z : 1) {
}
@@ -29,7 +32,7 @@ void VectorTileData::parse() {
// 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(), map.getSpriteAtlas(), map.getSprite());
+ map.getGlyphStore(), spriteAtlas, map.getSprite());
parser.parse();
} catch (const std::exception& ex) {
#if defined(DEBUG)