summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-07-12 16:16:21 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-07-13 11:57:09 +0300
commitc670b08ecb431b1bfd02da748de3d9fa16a757ec (patch)
treeb1c19eab6e4b895018df67da4cd5a61e75b431f2 /src
parenta73c81cc55671c8f3f5916c310353a22d6a6f231 (diff)
downloadqtlocation-mapboxgl-c670b08ecb431b1bfd02da748de3d9fa16a757ec.tar.gz
[core] Use PropertyValue<T> for Annotation line/fill
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/renderer/painter_fill.cpp7
-rw-r--r--src/mbgl/style/layers/fill_layer_properties.hpp2
-rw-r--r--src/mbgl/style/paint_property.hpp6
3 files changed, 8 insertions, 7 deletions
diff --git a/src/mbgl/renderer/painter_fill.cpp b/src/mbgl/renderer/painter_fill.cpp
index 3c0eb515a7..9af2af9d10 100644
--- a/src/mbgl/renderer/painter_fill.cpp
+++ b/src/mbgl/renderer/painter_fill.cpp
@@ -24,11 +24,8 @@ void Painter::renderFill(PaintParameters& parameters,
Color fillColor = properties.fillColor;
float opacity = properties.fillOpacity;
- Color strokeColor = properties.fillOutlineColor;
- bool isOutlineColorDefined = strokeColor.a >= 0;
- if (!isOutlineColorDefined) {
- strokeColor = fillColor;
- }
+ const bool isOutlineColorDefined = !properties.fillOutlineColor.isUndefined();
+ Color strokeColor = isOutlineColorDefined? properties.fillOutlineColor : fillColor;
auto worldSize = util::convert<GLfloat>(frame.framebufferSize);
diff --git a/src/mbgl/style/layers/fill_layer_properties.hpp b/src/mbgl/style/layers/fill_layer_properties.hpp
index 82981a9b64..225fec4f4b 100644
--- a/src/mbgl/style/layers/fill_layer_properties.hpp
+++ b/src/mbgl/style/layers/fill_layer_properties.hpp
@@ -20,7 +20,7 @@ public:
PaintProperty<bool> fillAntialias { true };
PaintProperty<float> fillOpacity { 1 };
PaintProperty<Color> fillColor { { 0, 0, 0, 1 } };
- PaintProperty<Color> fillOutlineColor { { 0, 0, 0, -1 } };
+ PaintProperty<Color> fillOutlineColor { {} };
PaintProperty<std::array<float, 2>> fillTranslate { {{ 0, 0 }} };
PaintProperty<TranslateAnchorType> fillTranslateAnchor { TranslateAnchorType::Map };
PaintProperty<std::string, CrossFadedPropertyEvaluator> fillPattern { "" };
diff --git a/src/mbgl/style/paint_property.hpp b/src/mbgl/style/paint_property.hpp
index b982fe76e2..332ec051dc 100644
--- a/src/mbgl/style/paint_property.hpp
+++ b/src/mbgl/style/paint_property.hpp
@@ -39,8 +39,12 @@ public:
return *this;
}
+ bool isUndefined() const {
+ return values.find(ClassID::Default) == values.end();
+ }
+
const PropertyValue<T>& get() const {
- return values.at(ClassID::Default);
+ return isUndefined() ? values.at(ClassID::Fallback) : values.at(ClassID::Default);
}
void set(const PropertyValue<T>& value_, const optional<std::string>& klass) {