move activeSources to internal Map context
This commit is contained in:
committed by
John Firebaugh
parent
89167cbf8c
commit
7c8c45edab
@@ -26,10 +26,8 @@ namespace mbgl {
|
||||
|
||||
class Painter;
|
||||
class GlyphStore;
|
||||
class LayerDescription;
|
||||
class Sprite;
|
||||
class Style;
|
||||
class StyleLayer;
|
||||
class TexturePool;
|
||||
class FileSource;
|
||||
class View;
|
||||
@@ -38,11 +36,11 @@ class SpriteAtlas;
|
||||
class LineAtlas;
|
||||
class Environment;
|
||||
class EnvironmentScope;
|
||||
class AnnotationManager;
|
||||
class MapData;
|
||||
class Worker;
|
||||
class StillImage;
|
||||
class TileID;
|
||||
class MapContext;
|
||||
|
||||
class Map : private util::noncopyable {
|
||||
friend class View;
|
||||
@@ -220,6 +218,7 @@ private:
|
||||
std::unique_ptr<EnvironmentScope> scope;
|
||||
View &view;
|
||||
const std::unique_ptr<MapData> data;
|
||||
const std::unique_ptr<MapContext> context;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Worker> workers;
|
||||
|
||||
@@ -58,13 +58,19 @@ const static bool uvVersionCheck = []() {
|
||||
return true;
|
||||
}();
|
||||
|
||||
using namespace mbgl;
|
||||
namespace mbgl {
|
||||
|
||||
class MapContext {
|
||||
public:
|
||||
};
|
||||
|
||||
|
||||
Map::Map(View& view_, FileSource& fileSource_)
|
||||
: env(util::make_unique<Environment>(fileSource_)),
|
||||
scope(util::make_unique<EnvironmentScope>(*env, ThreadType::Main, "Main")),
|
||||
view(view_),
|
||||
data(util::make_unique<MapData>(view_)),
|
||||
context(util::make_unique<MapContext>()),
|
||||
fileSource(fileSource_),
|
||||
glyphAtlas(util::make_unique<GlyphAtlas>(1024, 1024)),
|
||||
glyphStore(std::make_shared<GlyphStore>(*env)),
|
||||
@@ -688,7 +694,7 @@ LatLngBounds Map::getBoundsForAnnotations(const std::vector<uint32_t>& annotatio
|
||||
}
|
||||
|
||||
void Map::updateAnnotationTiles(const std::vector<TileID>& ids) {
|
||||
assert(Environment::currentlyOn(ThreadType::Map));
|
||||
assert(Environment::currentlyOn(ThreadType::Main));
|
||||
if (!style) return;
|
||||
for (const auto &source : style->sources) {
|
||||
if (source->info.type == SourceType::Annotations) {
|
||||
@@ -921,4 +927,6 @@ void Map::onLowMemory() {
|
||||
}
|
||||
env->performCleanup();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -398,9 +398,9 @@ void Source::update(MapData& data,
|
||||
}
|
||||
|
||||
if (info.type != SourceType::Raster && cache.getSize() == 0) {
|
||||
size_t conservativeCacheSize = ((float)map.getState().getWidth() / util::tileSize) *
|
||||
((float)map.getState().getHeight() / util::tileSize) *
|
||||
(map.getMaxZoom() - map.getMinZoom() + 1) *
|
||||
size_t conservativeCacheSize = ((float)data.getTransformState().getWidth() / util::tileSize) *
|
||||
((float)data.getTransformState().getHeight() / util::tileSize) *
|
||||
(data.transform.getMaxZoom() - data.transform.getMinZoom() + 1) *
|
||||
0.5;
|
||||
cache.setSize(conservativeCacheSize);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user