summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-07-14 16:18:09 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-07-14 16:24:11 +0300
commit9ef30c23527ef0e8dfe4a7b486624a284ccc016a (patch)
treedca8f5a1168d05e409a322411befc4222077d98d /src
parent765e8d2be18411cc13438cb4c723b6a6658b8c10 (diff)
downloadqtlocation-mapboxgl-9ef30c23527ef0e8dfe4a7b486624a284ccc016a.tar.gz
[core] Update color layer properties code generator
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/style/layers/layer_properties.hpp.ejs8
-rw-r--r--src/mbgl/style/paint_property.hpp4
2 files changed, 10 insertions, 2 deletions
diff --git a/src/mbgl/style/layers/layer_properties.hpp.ejs b/src/mbgl/style/layers/layer_properties.hpp.ejs
index a485621ac6..6ec92703f1 100644
--- a/src/mbgl/style/layers/layer_properties.hpp.ejs
+++ b/src/mbgl/style/layers/layer_properties.hpp.ejs
@@ -37,7 +37,13 @@ public:
<% if (/-pattern$/.test(property.name) || property.name === 'line-dasharray') { -%>
PaintProperty<<%- propertyType(property) %>, CrossFadedPropertyEvaluator> <%- camelizeWithLeadingLowercase(property.name) %> { <%- defaultValue(property) %> };
<% } else if (property.name === 'fill-outline-color') { -%>
- PaintProperty<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %> { { 0, 0, 0, -1 } };
+ PaintProperty<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %> { {} };
+<% } else if (property.name.endsWith('color') && defaultValue(property) === '{ 0, 0, 0, 0 }') { -%>
+ PaintProperty<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %> { {} };
+<% } else if (property.name.endsWith('color') && defaultValue(property) === '{ 0, 0, 0, 1 }') { -%>
+ PaintProperty<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %> { Color::black() };
+<% } else if (property.name.endsWith('color') && defaultValue(property) === '{ 1, 1, 1, 1 }') { -%>
+ PaintProperty<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %> { Color::white() };
<% } else { -%>
PaintProperty<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %> { <%- defaultValue(property) %> };
<% } -%>
diff --git a/src/mbgl/style/paint_property.hpp b/src/mbgl/style/paint_property.hpp
index 332ec051dc..6da1ed53b4 100644
--- a/src/mbgl/style/paint_property.hpp
+++ b/src/mbgl/style/paint_property.hpp
@@ -44,7 +44,9 @@ public:
}
const PropertyValue<T>& get() const {
- return isUndefined() ? values.at(ClassID::Fallback) : values.at(ClassID::Default);
+ static const PropertyValue<T> staticValue;
+ const auto it = values.find(ClassID::Default);
+ return it == values.end() ? staticValue : it->second;
}
void set(const PropertyValue<T>& value_, const optional<std::string>& klass) {