summaryrefslogtreecommitdiff
path: root/src/mbgl/layer/fill_layer.cpp
blob: ba3001efa6350d02ae7fa73f03ca6f7f8a056ba4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <mbgl/layer/fill_layer.hpp>

namespace mbgl {

void FillLayer::recalculate(const StyleCalculationParameters& parameters) {
    paints.removeExpiredTransitions(parameters.now);

    paints.calculate(PropertyKey::FillAntialias, properties.antialias, parameters);
    paints.calculateTransitioned(PropertyKey::FillOpacity, properties.opacity, parameters);
    paints.calculateTransitioned(PropertyKey::FillColor, properties.fill_color, parameters);
    paints.calculateTransitioned(PropertyKey::FillOutlineColor, properties.stroke_color, parameters);
    paints.calculateTransitioned(PropertyKey::FillTranslate, properties.translate, parameters);
    paints.calculate(PropertyKey::FillTranslateAnchor, properties.translateAnchor, parameters);
    paints.calculate(PropertyKey::FillImage, properties.image, parameters);

    passes = RenderPass::None;

    if (properties.antialias) {
        passes |= RenderPass::Translucent;
    }

    if (!properties.image.from.empty() || (properties.fill_color[3] * properties.opacity) < 1.0f) {
        passes |= RenderPass::Translucent;
    } else {
        passes |= RenderPass::Opaque;
    }
}

}