diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-04-25 09:51:47 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-04-25 09:51:47 -0700 |
commit | c4089b60bc630ee78c6755ebd7702943a30dd07d (patch) | |
tree | 662db1271ba46939efc6395b97fb609f828876a2 /src/mbgl/style/paint_property.hpp | |
parent | 42043599ffca9658d47792a85c136cb2384e35ed (diff) | |
download | qtlocation-mapboxgl-c4089b60bc630ee78c6755ebd7702943a30dd07d.tar.gz |
[core] Extract Function::evaluation to a separate class (#4811)
This allows the Function<Faded<T>> partial specialization to be eliminated, giving all property functions a consistent storage type.
Diffstat (limited to 'src/mbgl/style/paint_property.hpp')
-rw-r--r-- | src/mbgl/style/paint_property.hpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mbgl/style/paint_property.hpp b/src/mbgl/style/paint_property.hpp index e742b2c109..124b0a7c0a 100644 --- a/src/mbgl/style/paint_property.hpp +++ b/src/mbgl/style/paint_property.hpp @@ -4,6 +4,7 @@ #include <mbgl/style/class_dictionary.hpp> #include <mbgl/style/property_parsing.hpp> #include <mbgl/style/function.hpp> +#include <mbgl/style/function_evaluator.hpp> #include <mbgl/style/property_transition.hpp> #include <mbgl/style/style_cascade_parameters.hpp> #include <mbgl/style/style_calculation_parameters.hpp> @@ -16,10 +17,11 @@ namespace mbgl { -template <typename T, typename Result = T> +template <class T, template <class S> class Evaluator = NormalFunctionEvaluator> class PaintProperty { public: - using Fn = Function<Result>; + using Fn = Function<T>; + using Result = typename Evaluator<T>::ResultType; explicit PaintProperty(T fallbackValue) : value(fallbackValue) { @@ -114,7 +116,8 @@ public: } Result calculate(const StyleCalculationParameters& parameters) { - Result final = value.evaluate(parameters); + Evaluator<T> evaluator; + Result final = evaluator(value, parameters); if (!prior) { // No prior value. return final; |