summaryrefslogtreecommitdiff
path: root/src/mbgl/style
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-03-29 17:49:01 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-04-02 17:56:16 +0300
commitebe6f7dea33c59b91464f7c6c905600184324f3c (patch)
tree2ca2b78bbf5b82b3dc51cf8ca0abdff183b55571 /src/mbgl/style
parent45e8154d334aa967ac22910cad1f3d96f4c8e72b (diff)
downloadqtlocation-mapboxgl-ebe6f7dea33c59b91464f7c6c905600184324f3c.tar.gz
[core] Remove RenderLinePaintProperties
This patch removes the `RenderLinePaintProperties` by making `LineFloorWidth` part of the `style::LinePaintProperties`. It normalizes paint properties evaluation for the line layer.
Diffstat (limited to 'src/mbgl/style')
-rw-r--r--src/mbgl/style/layers/layer.cpp.ejs3
-rw-r--r--src/mbgl/style/layers/layer_properties.hpp.ejs10
-rw-r--r--src/mbgl/style/layers/line_layer.cpp1
-rw-r--r--src/mbgl/style/layers/line_layer_properties.hpp6
4 files changed, 20 insertions, 0 deletions
diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs
index fcae615fe0..201189c849 100644
--- a/src/mbgl/style/layers/layer.cpp.ejs
+++ b/src/mbgl/style/layers/layer.cpp.ejs
@@ -153,6 +153,9 @@ void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(<%- propertyV
return;
auto impl_ = mutableImpl();
impl_->paint.template get<<%- camelize(property.name) %>>().value = value;
+<% if (property.name === 'line-width') { -%>
+ impl_->paint.template get<LineFloorWidth>().value = value;
+<% } -%>
baseImpl = std::move(impl_);
observer->onLayerChanged(*this);
}
diff --git a/src/mbgl/style/layers/layer_properties.hpp.ejs b/src/mbgl/style/layers/layer_properties.hpp.ejs
index 89dffdcd42..de647fbc07 100644
--- a/src/mbgl/style/layers/layer_properties.hpp.ejs
+++ b/src/mbgl/style/layers/layer_properties.hpp.ejs
@@ -37,6 +37,13 @@ struct <%- camelize(property.name) %> : <%- paintPropertyType(property, type) %>
template<typename T> static bool hasOverride(const T& t) { return !!t.<%- camelizeWithLeadingLowercase(property.name) %>; };
<% } -%>
};
+<% if (property.name === 'line-width') { -%>
+
+struct LineFloorWidth : DataDrivenPaintProperty<float, attributes::floorwidth, uniforms::floorwidth> {
+ using EvaluatorType = DataDrivenPropertyEvaluator<float, true>;
+ static float defaultValue() { return 1.0f; }
+};
+<% } -%>
<% } -%>
<% } -%>
@@ -52,6 +59,9 @@ class <%- camelize(type) %>LayoutProperties : public Properties<
class <%- camelize(type) %>PaintProperties : public Properties<
<% for (const property of paintProperties.slice(0, -1)) { -%>
<%- camelize(property.name) %>,
+<% if (property.name === 'line-width') { -%>
+ LineFloorWidth,
+<% } -%>
<% } -%>
<%- camelize(paintProperties.slice(-1)[0].name) %>
> {};
diff --git a/src/mbgl/style/layers/line_layer.cpp b/src/mbgl/style/layers/line_layer.cpp
index 643c294edf..0a20762697 100644
--- a/src/mbgl/style/layers/line_layer.cpp
+++ b/src/mbgl/style/layers/line_layer.cpp
@@ -248,6 +248,7 @@ void LineLayer::setLineWidth(PropertyValue<float> value) {
return;
auto impl_ = mutableImpl();
impl_->paint.template get<LineWidth>().value = value;
+ impl_->paint.template get<LineFloorWidth>().value = value;
baseImpl = std::move(impl_);
observer->onLayerChanged(*this);
}
diff --git a/src/mbgl/style/layers/line_layer_properties.hpp b/src/mbgl/style/layers/line_layer_properties.hpp
index 208c2d142f..33d7eddbe8 100644
--- a/src/mbgl/style/layers/line_layer_properties.hpp
+++ b/src/mbgl/style/layers/line_layer_properties.hpp
@@ -52,6 +52,11 @@ struct LineWidth : DataDrivenPaintProperty<float, attributes::width, uniforms::w
static float defaultValue() { return 1; }
};
+struct LineFloorWidth : DataDrivenPaintProperty<float, attributes::floorwidth, uniforms::floorwidth> {
+ using EvaluatorType = DataDrivenPropertyEvaluator<float, true>;
+ static float defaultValue() { return 1.0f; }
+};
+
struct LineGapWidth : DataDrivenPaintProperty<float, attributes::gapwidth, uniforms::gapwidth> {
static float defaultValue() { return 0; }
};
@@ -88,6 +93,7 @@ class LinePaintProperties : public Properties<
LineTranslate,
LineTranslateAnchor,
LineWidth,
+ LineFloorWidth,
LineGapWidth,
LineOffset,
LineBlur,