summaryrefslogtreecommitdiff
path: root/src/mbgl
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-05-27 13:43:38 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-06-10 12:42:14 +0200
commit2c7f7fb5669088cbd6d6a7471a377f28195adaf6 (patch)
tree330d9710aecd0162e03fa1430d975bfdcc3e01c3 /src/mbgl
parent4673a9d6b3d8bd90c1e6fe9b2cd4bcd07519c0f2 (diff)
downloadqtlocation-mapboxgl-2c7f7fb5669088cbd6d6a7471a377f28195adaf6.tar.gz
[core] createTile callback can load optional and required tiles
Diffstat (limited to 'src/mbgl')
-rw-r--r--src/mbgl/algorithm/update_renderables.hpp2
-rw-r--r--src/mbgl/style/source.cpp7
2 files changed, 6 insertions, 3 deletions
diff --git a/src/mbgl/algorithm/update_renderables.hpp b/src/mbgl/algorithm/update_renderables.hpp
index 22d4205d90..1f58075a58 100644
--- a/src/mbgl/algorithm/update_renderables.hpp
+++ b/src/mbgl/algorithm/update_renderables.hpp
@@ -33,7 +33,7 @@ void updateRenderables(GetTileDataFn getTileData,
const OverscaledTileID idealDataTileID(dataTileZoom, idealRenderTileID.canonical);
auto data = getTileData(idealDataTileID);
if (!data) {
- data = createTileData(idealDataTileID);
+ data = createTileData(idealDataTileID, true);
assert(data);
}
diff --git a/src/mbgl/style/source.cpp b/src/mbgl/style/source.cpp
index dcf8278c0d..89701a2e8a 100644
--- a/src/mbgl/style/source.cpp
+++ b/src/mbgl/style/source.cpp
@@ -285,9 +285,12 @@ bool Source::update(const UpdateParameters& parameters) {
auto getTileDataFn = [this](const OverscaledTileID& dataTileID) -> TileData* {
return getTileData(dataTileID);
};
- auto createTileDataFn = [this, &parameters](const OverscaledTileID& dataTileID) -> TileData* {
+ auto createTileDataFn = [this, &parameters](const OverscaledTileID& dataTileID,
+ bool required) -> TileData* {
if (auto data = createTile(dataTileID, parameters)) {
- data->getTileSource()->setNecessity(TileSource::Necessity::Required);
+ if (required) {
+ data->getTileSource()->setNecessity(TileSource::Necessity::Required);
+ }
return tileDataMap.emplace(dataTileID, std::move(data)).first->second.get();
} else {
return nullptr;