From cc9dab4024591a78c27e3e9d8be430ba35beb127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 2 Jul 2014 15:57:52 +0200 Subject: [PATCH] parse rasterize values as well --- include/llmr/renderer/prerendered_texture.hpp | 4 +- include/llmr/style/class_properties.hpp | 11 +- include/llmr/style/function_properties.hpp | 5 + include/llmr/style/rasterize_properties.hpp | 25 +-- include/llmr/style/style_parser.hpp | 10 +- src/renderer/prerendered_texture.cpp | 2 +- src/style/style_parser.cpp | 188 ++++++++++-------- 7 files changed, 144 insertions(+), 101 deletions(-) diff --git a/include/llmr/renderer/prerendered_texture.hpp b/include/llmr/renderer/prerendered_texture.hpp index 6ca3cd540..168284e1d 100644 --- a/include/llmr/renderer/prerendered_texture.hpp +++ b/include/llmr/renderer/prerendered_texture.hpp @@ -11,7 +11,7 @@ class Painter; class PrerenderedTexture : private util::noncopyable { public: - PrerenderedTexture(const PrerenderProperties &properties); + PrerenderedTexture(const RasterizedProperties &properties); ~PrerenderedTexture(); void bindTexture(); @@ -23,7 +23,7 @@ public: void blur(Painter& painter, uint16_t passes); public: - const PrerenderProperties properties; + const RasterizedProperties properties; private: GLint previous_fbo = 0; diff --git a/include/llmr/style/class_properties.hpp b/include/llmr/style/class_properties.hpp index a1720e172..55d6aa2cc 100644 --- a/include/llmr/style/class_properties.hpp +++ b/include/llmr/style/class_properties.hpp @@ -15,13 +15,12 @@ public: inline ClassProperties(ClassProperties &&properties) : properties(std::move(properties.properties)) {} - template - inline void set(Args&& ...args) { - properties.emplace(::std::forward(args)...); + inline void set(PropertyKey key, const PropertyValue &value) { + properties.emplace(key, value); } - template - inline void setTransition(Args&& ...args) { - transitions.emplace(::std::forward(args)...); + + inline void set(PropertyKey key, const PropertyTransition &transition) { + transitions.emplace(key, transition); } const PropertyTransition &getTransition(PropertyKey key, const PropertyTransition &defaultTransition) const; diff --git a/include/llmr/style/function_properties.hpp b/include/llmr/style/function_properties.hpp index d1e1a5b1c..75714d119 100644 --- a/include/llmr/style/function_properties.hpp +++ b/include/llmr/style/function_properties.hpp @@ -50,6 +50,7 @@ private: template using Function = util::variant< + std::false_type, ConstantFunction, LinearFunction, ExponentialFunction, @@ -61,6 +62,10 @@ struct FunctionEvaluator { typedef T result_type; inline FunctionEvaluator(float z) : z(z) {} + inline result_type operator()(const std::false_type &) { + return result_type(); + } + template