aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrUnpremulInputFragmentProcessor.fp
blob: 65395f34fcfe16139dc22e01c18af0d7ed0a9bc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
@optimizationFlags {
    kPreservesOpaqueInput_OptimizationFlag | kConstantOutputForConstantInput_OptimizationFlag
}

void main() {
    sk_OutColor = sk_InColor;
    half invAlpha = sk_InColor.a <= 0 ? 0 : 1 / sk_InColor.a;
    sk_OutColor.rgb *= invAlpha;
}

@class {
    GrColor4f constantOutputForConstantInput(GrColor4f input) const override {
        return input.unpremul();
    }
}