diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-06-13 16:04:13 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-06-14 11:14:05 -0700 |
commit | fd45242d05e496d24b814a567c3f24a4c82b499f (patch) | |
tree | b56ed3571adf3885f3d8dde768b3c93937c615ae /src/mbgl/programs | |
parent | 12279b5dcc4205d1b96ae4374322ed40735a2836 (diff) | |
download | qtlocation-mapboxgl-fd45242d05e496d24b814a567c3f24a4c82b499f.tar.gz |
[core] Don't use "current" icon/text-size when binding
The current value is not passed to `SymbolSizeBinder::uniformValues`, so we shouldn't check `currentValue.isConstant()` in `SymbolSizeBinder::attributeBindings`. If it were true, then we might end up using attribute bindings that are appropriate only for a constant property, but uniform bindings that are appropriate only for a source or composite function.
Instead, just wait for a new bucket to be generated. This will happen automatically, since icon/text-size are layout properties.
Diffstat (limited to 'src/mbgl/programs')
-rw-r--r-- | src/mbgl/programs/symbol_program.hpp | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp index 358fa08ecd..4cde5695e6 100644 --- a/src/mbgl/programs/symbol_program.hpp +++ b/src/mbgl/programs/symbol_program.hpp @@ -106,7 +106,7 @@ public: const style::DataDrivenPropertyValue<float>& sizeProperty, const float defaultValue); - virtual SymbolSizeAttributes::Bindings attributeBindings(const PossiblyEvaluatedPropertyValue<float> currentValue) const = 0; + virtual SymbolSizeAttributes::Bindings attributeBindings() const = 0; virtual void populateVertexVector(const GeometryTileFeature& feature) = 0; virtual UniformValues uniformValues(float currentZoom) const = 0; virtual void upload(gl::Context&) = 0; @@ -132,8 +132,6 @@ Range<float> getCoveringStops(Stops s, float lowerZoom, float upperZoom) { class ConstantSymbolSizeBinder final : public SymbolSizeBinder { public: - using PropertyValue = variant<float, style::CameraFunction<float>>; - ConstantSymbolSizeBinder(const float /*tileZoom*/, const float& size, const float /*defaultValue*/) : layoutSize(size) {} @@ -157,7 +155,7 @@ public: ); } - SymbolSizeAttributes::Bindings attributeBindings(const PossiblyEvaluatedPropertyValue<float>) const override { + SymbolSizeAttributes::Bindings attributeBindings() const override { return SymbolSizeAttributes::Bindings { SymbolSizeAttributes::Attribute::ConstantBinding {{{0, 0, 0}}} }; } void upload(gl::Context&) override {} @@ -211,11 +209,7 @@ public: defaultValue(defaultValue_) { } - SymbolSizeAttributes::Bindings attributeBindings(const PossiblyEvaluatedPropertyValue<float> currentValue) const override { - if (currentValue.isConstant()) { - return SymbolSizeAttributes::Bindings { SymbolSizeAttributes::Attribute::ConstantBinding {{{0, 0, 0}}} }; - } - + SymbolSizeAttributes::Bindings attributeBindings() const override { return SymbolSizeAttributes::Bindings { SymbolSizeAttributes::Attribute::variableBinding(*buffer, 0, 1) }; } @@ -268,11 +262,7 @@ public: return getCoveringStops(stops, tileZoom, tileZoom + 1); })) {} - SymbolSizeAttributes::Bindings attributeBindings(const PossiblyEvaluatedPropertyValue<float> currentValue) const override { - if (currentValue.isConstant()) { - return SymbolSizeAttributes::Bindings { SymbolSizeAttributes::Attribute::ConstantBinding {{{0, 0, 0}}} }; - } - + SymbolSizeAttributes::Bindings attributeBindings() const override { return SymbolSizeAttributes::Bindings { SymbolSizeAttributes::Attribute::variableBinding(*buffer, 0) }; } @@ -364,7 +354,6 @@ public: UniformValues&& uniformValues, const gl::VertexBuffer<LayoutVertex>& layoutVertexBuffer, const SymbolSizeBinder& symbolSizeBinder, - const PossiblyEvaluatedPropertyValue<float>& currentSizeValue, const gl::IndexBuffer<DrawMode>& indexBuffer, const gl::SegmentVector<Attributes>& segments, const PaintPropertyBinders& paintPropertyBinders, @@ -380,7 +369,7 @@ public: .concat(symbolSizeBinder.uniformValues(currentZoom)) .concat(paintPropertyBinders.uniformValues(currentZoom, currentProperties)), LayoutAttributes::allVariableBindings(layoutVertexBuffer) - .concat(symbolSizeBinder.attributeBindings(currentSizeValue)) + .concat(symbolSizeBinder.attributeBindings()) .concat(paintPropertyBinders.attributeBindings(currentProperties)), indexBuffer, segments |