summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers/symbol_layer_impl.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/layers/symbol_layer_impl.hpp')
-rw-r--r--src/mbgl/style/layers/symbol_layer_impl.hpp50
1 files changed, 34 insertions, 16 deletions
diff --git a/src/mbgl/style/layers/symbol_layer_impl.hpp b/src/mbgl/style/layers/symbol_layer_impl.hpp
index db18da07e2..1e9f05e4c7 100644
--- a/src/mbgl/style/layers/symbol_layer_impl.hpp
+++ b/src/mbgl/style/layers/symbol_layer_impl.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <mbgl/util/variant.hpp>
#include <mbgl/style/layer_impl.hpp>
#include <mbgl/style/layers/symbol_layer.hpp>
#include <mbgl/style/layers/symbol_layer_properties.hpp>
@@ -10,6 +11,30 @@ class SpriteAtlas;
class SymbolLayout;
namespace style {
+
+
+// {icon,text}-specific paint-property packs for use in the symbol Programs.
+// Since each program deals either with icons or text, using a smaller property set
+// lets us avoid unnecessarily binding attributes for properties the program wouldn't use.
+class IconPaintProperties : public PaintProperties<
+ IconOpacity,
+ IconColor,
+ IconHaloColor,
+ IconHaloWidth,
+ IconHaloBlur,
+ IconTranslate,
+ IconTranslateAnchor
+> {};
+
+class TextPaintProperties : public PaintProperties<
+ TextOpacity,
+ TextColor,
+ TextHaloColor,
+ TextHaloWidth,
+ TextHaloBlur,
+ TextTranslate,
+ TextTranslateAnchor
+> {};
// Repackaging evaluated values from SymbolLayoutProperties + SymbolPaintProperties
// for genericity over icons vs. text.
@@ -21,24 +46,14 @@ public:
float layoutSize;
// Paint
- float opacity;
- Color color;
- Color haloColor;
- float haloWidth;
- float haloBlur;
std::array<float, 2> translate;
TranslateAnchorType translateAnchor;
float paintSize;
float sdfScale; // Constant (1.0 or 24.0)
-
- bool hasHalo() const {
- return haloColor.a > 0.0f && haloWidth > 0.0f;
- }
-
- bool hasForeground() const {
- return color.a > 0.0f;
- }
+
+ bool hasHalo;
+ bool hasFill;
};
class SymbolLayer::Impl : public Layer::Impl {
@@ -50,10 +65,13 @@ public:
void cascade(const CascadeParameters&) override;
bool evaluate(const PropertyEvaluationParameters&) override;
- std::unique_ptr<Bucket> createBucket(BucketParameters&, const GeometryTileLayer&) const override;
- std::unique_ptr<SymbolLayout> createLayout(BucketParameters&, const GeometryTileLayer&,
- std::vector<std::string>) const;
+ std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const Layer*>&) const override;
+ std::unique_ptr<SymbolLayout> createLayout(const BucketParameters&, const std::vector<const Layer*>&,
+ const GeometryTileLayer&) const;
+ IconPaintProperties::Evaluated iconPaintProperties() const;
+ TextPaintProperties::Evaluated textPaintProperties() const;
+
SymbolPropertyValues iconPropertyValues(const SymbolLayoutProperties::Evaluated&) const;
SymbolPropertyValues textPropertyValues(const SymbolLayoutProperties::Evaluated&) const;