[core] Polymorphic layout and paint parsing

This commit is contained in:
John Firebaugh
2015-10-20 16:40:34 -07:00
parent b39501ba59
commit 7821dccae5
22 changed files with 810 additions and 821 deletions

View File

@@ -1,7 +1,16 @@
#include <mbgl/layer/background_layer.hpp>
#include <mbgl/style/property_parsing.hpp>
namespace mbgl {
void BackgroundLayer::parsePaints(const JSVal& layer) {
paints.parseEach(layer, [&] (ClassProperties& paint, const JSVal& value) {
parseProperty<Function<float>>("background-opacity", PropertyKey::BackgroundOpacity, paint, value);
parseProperty<Function<Color>>("background-color", PropertyKey::BackgroundColor, paint, value);
parseProperty<PiecewiseConstantFunction<Faded<std::string>>>("background-pattern", PropertyKey::BackgroundImage, paint, value, "background-pattern-transition");
});
}
void BackgroundLayer::recalculate(const StyleCalculationParameters& parameters) {
paints.removeExpiredTransitions(parameters.now);