[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,26 @@
#include <mbgl/layer/raster_layer.hpp>
#include <mbgl/style/property_parsing.hpp>
namespace mbgl {
void RasterLayer::parsePaints(const JSVal& layer) {
paints.parseEach(layer, [&] (ClassProperties& paint, const JSVal& value) {
parseProperty<Function<float>>("raster-opacity", PropertyKey::RasterOpacity, paint, value);
parseProperty<PropertyTransition>("raster-opacity-transition", PropertyKey::RasterOpacity, paint, value);
parseProperty<Function<float>>("raster-hue-rotate", PropertyKey::RasterHueRotate, paint, value);
parseProperty<PropertyTransition>("raster-hue-rotate-transition", PropertyKey::RasterHueRotate, paint, value);
parseProperty<Function<float>>("raster-brightness-min", PropertyKey::RasterBrightnessLow, paint, value);
parseProperty<Function<float>>("raster-brightness-max", PropertyKey::RasterBrightnessHigh, paint, value);
parseProperty<PropertyTransition>("raster-brightness-transition", PropertyKey::RasterBrightness, paint, value);
parseProperty<Function<float>>("raster-saturation", PropertyKey::RasterSaturation, paint, value);
parseProperty<PropertyTransition>("raster-saturation-transition", PropertyKey::RasterSaturation, paint, value);
parseProperty<Function<float>>("raster-contrast", PropertyKey::RasterContrast, paint, value);
parseProperty<PropertyTransition>("raster-contrast-transition", PropertyKey::RasterContrast, paint, value);
parseProperty<Function<float>>("raster-fade-duration", PropertyKey::RasterFade, paint, value);
parseProperty<PropertyTransition>("raster-fade-duration-transition", PropertyKey::RasterFade, paint, value);
});
}
void RasterLayer::recalculate(const StyleCalculationParameters& parameters) {
paints.removeExpiredTransitions(parameters.now);