summaryrefslogtreecommitdiff
path: root/src/mbgl/style
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-11-30 12:48:30 -0800
committerJohn Firebaugh <john@Johns-MacBook-Pro.local>2015-12-01 09:07:03 -0800
commitf27c28b6c4a4796eded7984d7bb3c62f30ba594f (patch)
tree1223ea7fd6a50e34143982d646bb325665b434b6 /src/mbgl/style
parent60b0e78e0ef7357cf6ef260a6df4241b2c5503db (diff)
downloadqtlocation-mapboxgl-f27c28b6c4a4796eded7984d7bb3c62f30ba594f.tar.gz
Partially revert "[core] Source should receive a ref to MapData just once"
This partially reverts commit d55aa7929cb10d40a58b6b7a8ed73bddd4f0a407.
Diffstat (limited to 'src/mbgl/style')
-rw-r--r--src/mbgl/style/style.cpp4
-rw-r--r--src/mbgl/style/style_parser.cpp7
-rw-r--r--src/mbgl/style/style_parser.hpp5
3 files changed, 3 insertions, 13 deletions
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index b7533db4a3..16a9fddd95 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -43,7 +43,7 @@ void Style::setJSON(const std::string& json, const std::string&) {
return;
}
- StyleParser parser(data);
+ StyleParser parser;
parser.parse(doc);
for (auto& source : parser.getSources()) {
@@ -105,7 +105,7 @@ void Style::update(const TransformState& transform,
TexturePool& texturePool) {
bool allTilesUpdated = true;
for (const auto& source : sources) {
- if (!source->update(transform, *this, texturePool, shouldReparsePartialTiles)) {
+ if (!source->update(data, transform, *this, texturePool, shouldReparsePartialTiles)) {
allTilesUpdated = false;
}
}
diff --git a/src/mbgl/style/style_parser.cpp b/src/mbgl/style/style_parser.cpp
index 2eb9562c90..dc14827dc6 100644
--- a/src/mbgl/style/style_parser.cpp
+++ b/src/mbgl/style/style_parser.cpp
@@ -1,17 +1,12 @@
#include <mbgl/style/style_parser.hpp>
#include <mbgl/style/style_layer.hpp>
-#include <mbgl/map/map_data.hpp>
#include <mbgl/platform/log.hpp>
#include <algorithm>
namespace mbgl {
-StyleParser::StyleParser(MapData& data_)
- : data(data_) {
-}
-
void StyleParser::parse(const JSVal& document) {
if (document.HasMember("version")) {
version = document["version"].GetInt();
@@ -54,7 +49,7 @@ void StyleParser::parseSources(const JSVal& value) {
const JSVal& nameVal = itr->name;
const JSVal& sourceVal = itr->value;
- std::unique_ptr<Source> source = std::make_unique<Source>(data);
+ std::unique_ptr<Source> source = std::make_unique<Source>();
source->info.source_id = { nameVal.GetString(), nameVal.GetStringLength() };
diff --git a/src/mbgl/style/style_parser.hpp b/src/mbgl/style/style_parser.hpp
index 126a3781db..489c9959f2 100644
--- a/src/mbgl/style/style_parser.hpp
+++ b/src/mbgl/style/style_parser.hpp
@@ -14,7 +14,6 @@
namespace mbgl {
-class MapData;
class StyleLayer;
class Source;
@@ -22,8 +21,6 @@ using JSVal = rapidjson::Value;
class StyleParser {
public:
- StyleParser(MapData&);
-
void parse(const JSVal&);
std::vector<std::unique_ptr<Source>>&& getSources() {
@@ -48,8 +45,6 @@ private:
void parseLayer(const std::string& id, const JSVal&, util::ptr<StyleLayer>&);
void parseVisibility(StyleLayer&, const JSVal& value);
- MapData& data;
-
std::uint8_t version;
std::vector<std::unique_ptr<Source>> sources;