summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mbgl/layout/symbol_layout.cpp6
-rw-r--r--src/mbgl/renderer/buckets/symbol_bucket.cpp22
-rw-r--r--src/mbgl/renderer/buckets/symbol_bucket.hpp13
-rw-r--r--src/mbgl/renderer/layers/render_symbol_layer.cpp16
4 files changed, 30 insertions, 27 deletions
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp
index 4acd0a1ccd..a95c414c82 100644
--- a/src/mbgl/layout/symbol_layout.cpp
+++ b/src/mbgl/layout/symbol_layout.cpp
@@ -469,9 +469,9 @@ void SymbolLayout::createBucket(const ImagePositions&, std::unique_ptr<FeatureIn
}
}
- for (auto& pair : bucket->paintPropertyBinders) {
- pair.second.first.populateVertexVectors(feature, bucket->icon.vertices.vertexSize(), {}, {});
- pair.second.second.populateVertexVectors(feature, bucket->text.vertices.vertexSize(), {}, {});
+ for (auto& pair : bucket->paintProperties) {
+ pair.second.iconBinders.populateVertexVectors(feature, bucket->icon.vertices.vertexSize(), {}, {});
+ pair.second.textBinders.populateVertexVectors(feature, bucket->text.vertices.vertexSize(), {}, {});
}
}
diff --git a/src/mbgl/renderer/buckets/symbol_bucket.cpp b/src/mbgl/renderer/buckets/symbol_bucket.cpp
index 4947b6b521..969597f5bd 100644
--- a/src/mbgl/renderer/buckets/symbol_bucket.cpp
+++ b/src/mbgl/renderer/buckets/symbol_bucket.cpp
@@ -9,7 +9,7 @@ namespace mbgl {
using namespace style;
SymbolBucket::SymbolBucket(style::SymbolLayoutProperties::PossiblyEvaluated layout_,
- std::map<std::string, style::SymbolPaintProperties::PossiblyEvaluated> paintProperties_,
+ const std::map<std::string, style::SymbolPaintProperties::PossiblyEvaluated>& paintProperties_,
const style::PropertyValue<float>& textSize,
const style::PropertyValue<float>& iconSize,
float zoom,
@@ -24,18 +24,18 @@ SymbolBucket::SymbolBucket(style::SymbolLayoutProperties::PossiblyEvaluated layo
sortFeaturesByY(sortFeaturesByY_),
bucketLeaderID(std::move(bucketName_)),
symbolInstances(std::move(symbolInstances_)),
- paintProperties(std::move(paintProperties_)),
textSizeBinder(SymbolSizeBinder::create(zoom, textSize, TextSize::defaultValue())),
iconSizeBinder(SymbolSizeBinder::create(zoom, iconSize, IconSize::defaultValue())) {
- for (const auto& pair : paintProperties) {
- paintPropertyBinders.emplace(
+ for (const auto& pair : paintProperties_) {
+ paintProperties.emplace(
std::piecewise_construct,
std::forward_as_tuple(pair.first),
- std::forward_as_tuple(
- std::piecewise_construct,
- std::forward_as_tuple(RenderSymbolLayer::iconPaintProperties(pair.second), zoom),
- std::forward_as_tuple(RenderSymbolLayer::textPaintProperties(pair.second), zoom)));
+ std::forward_as_tuple(PaintProperties {
+ pair.second,
+ { RenderSymbolLayer::iconPaintProperties(pair.second), zoom },
+ { RenderSymbolLayer::textPaintProperties(pair.second), zoom }
+ }));
}
}
@@ -110,9 +110,9 @@ void SymbolBucket::upload(gl::Context& context) {
}
if (!staticUploaded) {
- for (auto& pair : paintPropertyBinders) {
- pair.second.first.upload(context);
- pair.second.second.upload(context);
+ for (auto& pair : paintProperties) {
+ pair.second.iconBinders.upload(context);
+ pair.second.textBinders.upload(context);
}
}
diff --git a/src/mbgl/renderer/buckets/symbol_bucket.hpp b/src/mbgl/renderer/buckets/symbol_bucket.hpp
index 76fab2fa0f..0388c5756b 100644
--- a/src/mbgl/renderer/buckets/symbol_bucket.hpp
+++ b/src/mbgl/renderer/buckets/symbol_bucket.hpp
@@ -40,7 +40,7 @@ public:
class SymbolBucket final : public Bucket {
public:
SymbolBucket(style::SymbolLayoutProperties::PossiblyEvaluated,
- std::map<std::string, style::SymbolPaintProperties::PossiblyEvaluated>,
+ const std::map<std::string, style::SymbolPaintProperties::PossiblyEvaluated>&,
const style::PropertyValue<float>& textSize,
const style::PropertyValue<float>& iconSize,
float zoom,
@@ -78,11 +78,12 @@ public:
std::vector<SymbolInstance> symbolInstances;
- std::map<std::string, style::SymbolPaintProperties::PossiblyEvaluated> paintProperties;
-
- std::map<std::string, std::pair<
- SymbolIconProgram::PaintPropertyBinders,
- SymbolSDFTextProgram::PaintPropertyBinders>> paintPropertyBinders;
+ struct PaintProperties {
+ style::SymbolPaintProperties::PossiblyEvaluated evaluated;
+ SymbolIconProgram::PaintPropertyBinders iconBinders;
+ SymbolSDFTextProgram::PaintPropertyBinders textBinders;
+ };
+ std::map<std::string, PaintProperties> paintProperties;
std::unique_ptr<SymbolSizeBinder> textSizeBinder;
diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp
index 61dcf8fa47..bc605fe9eb 100644
--- a/src/mbgl/renderer/layers/render_symbol_layer.cpp
+++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp
@@ -102,7 +102,8 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
}
SymbolBucket& bucket = *bucket_;
assert(bucket.paintProperties.find(getID()) != bucket.paintProperties.end());
- const auto& evaluated_ = bucket.paintProperties.at(getID());
+ const auto& bucketPaintProperties = bucket.paintProperties.at(getID());
+ const auto& evaluated_ = bucketPaintProperties.evaluated;
const auto& layout = bucket.layout;
auto draw = [&] (auto& program,
@@ -187,7 +188,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
bucket.icon,
bucket.iconSizeBinder,
values,
- bucket.paintPropertyBinders.at(getID()).first,
+ bucketPaintProperties.iconBinders,
paintPropertyValues);
}
@@ -197,7 +198,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
bucket.icon,
bucket.iconSizeBinder,
values,
- bucket.paintPropertyBinders.at(getID()).first,
+ bucketPaintProperties.iconBinders,
paintPropertyValues);
}
} else {
@@ -206,7 +207,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
bucket.icon,
bucket.iconSizeBinder,
values,
- bucket.paintPropertyBinders.at(getID()).first,
+ bucketPaintProperties.iconBinders,
paintPropertyValues);
}
}
@@ -240,7 +241,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
bucket.text,
bucket.textSizeBinder,
values,
- bucket.paintPropertyBinders.at(getID()).second,
+ bucketPaintProperties.textBinders,
paintPropertyValues);
}
@@ -250,7 +251,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
bucket.text,
bucket.textSizeBinder,
values,
- bucket.paintPropertyBinders.at(getID()).second,
+ bucketPaintProperties.textBinders,
paintPropertyValues);
}
}
@@ -405,7 +406,8 @@ void RenderSymbolLayer::sortRenderTiles(const TransformState& state) {
}
void RenderSymbolLayer::updateBucketPaintProperties(Bucket* bucket) const {
- static_cast<SymbolBucket*>(bucket)->paintProperties[getID()] = evaluated;
+ assert(bucket->supportsLayer(*baseImpl));
+ static_cast<SymbolBucket*>(bucket)->paintProperties.at(getID()).evaluated = evaluated;
}
} // namespace mbgl