Convert Style to unique_ptr and pass by reference

Fixes #1277
Fixes #1309
This commit is contained in:
John Firebaugh
2015-04-23 17:16:00 -07:00
parent 0c280adebc
commit cdb466e7f7
10 changed files with 19 additions and 39 deletions

View File

@@ -139,7 +139,7 @@ void MapContext::loadStyleJSON(const std::string& json, const std::string& base)
assert(Environment::currentlyOn(ThreadType::Map));
sprite.reset();
style = std::make_shared<Style>();
style = util::make_unique<Style>();
style->base = base;
style->loadJSON((const uint8_t *)json.c_str());
style->cascade(data.getClasses());
@@ -162,7 +162,7 @@ void MapContext::updateTiles() {
assert(Environment::currentlyOn(ThreadType::Map));
if (!style) return;
for (const auto& source : style->sources) {
source->update(data, transformState, style, *glyphAtlas, *glyphStore, *spriteAtlas,
source->update(data, transformState, *style, *glyphAtlas, *glyphStore, *spriteAtlas,
getSprite(), *texturePool, [this]() {
assert(Environment::currentlyOn(ThreadType::Map));
triggerUpdate();