summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2014-11-25 18:09:38 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2014-11-26 15:13:14 -0800
commit167097936acbc77fe91bbf73ee59f447f8a10b9a (patch)
treeb1efda2081e5e0b8f2e77d8b17dcd0580dc5e533 /src
parent41e90b4150ba8302c0c6f9bec0f53059483fea9e (diff)
downloadqtlocation-mapboxgl-167097936acbc77fe91bbf73ee59f447f8a10b9a.tar.gz
Store SourceInfo as direct member
Diffstat (limited to 'src')
-rw-r--r--src/map/map.cpp2
-rw-r--r--src/style/style_parser.cpp12
2 files changed, 6 insertions, 8 deletions
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 2df3e068fb..eb0a48d8d6 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -606,7 +606,7 @@ void Map::updateSources() {
for (const util::ptr<StyleSource> &style_source : activeSources) {
if (style_source->enabled) {
if (!style_source->source) {
- style_source->source = std::make_shared<Source>(*style_source->info);
+ style_source->source = std::make_shared<Source>(style_source->info);
style_source->source->load(*this, *fileSource);
}
} else {
diff --git a/src/style/style_parser.cpp b/src/style/style_parser.cpp
index fa51e48cee..22d43df443 100644
--- a/src/style/style_parser.cpp
+++ b/src/style/style_parser.cpp
@@ -178,14 +178,12 @@ void StyleParser::parseSources(JSVal value) {
rapidjson::Value::ConstMemberIterator itr = value.MemberBegin();
for (; itr != value.MemberEnd(); ++itr) {
std::string name { itr->name.GetString(), itr->name.GetStringLength() };
- util::ptr<SourceInfo> info = std::make_shared<SourceInfo>();
+ SourceInfo& info = sources.emplace(name, std::make_shared<StyleSource>()).first->second->info;
- parseRenderProperty<SourceTypeClass>(itr->value, info->type, "type");
- parseRenderProperty(itr->value, info->url, "url");
- parseRenderProperty(itr->value, info->tile_size, "tileSize");
- info->parseTileJSONProperties(itr->value);
-
- sources.emplace(std::move(name), std::make_shared<StyleSource>(info));
+ parseRenderProperty<SourceTypeClass>(itr->value, info.type, "type");
+ parseRenderProperty(itr->value, info.url, "url");
+ parseRenderProperty(itr->value, info.tile_size, "tileSize");
+ info.parseTileJSONProperties(itr->value);
}
} else {
Log::Warning(Event::ParseStyle, "sources must be an object");