1/*
2 * Copyright 2018 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8@optimizationFlags {
9    kPreservesOpaqueInput_OptimizationFlag | kConstantOutputForConstantInput_OptimizationFlag
10}
11
12void main() {
13    sk_OutColor = sk_InColor;
14    half invAlpha = sk_InColor.a <= 0 ? 0 : 1 / sk_InColor.a;
15    sk_OutColor.rgb *= invAlpha;
16}
17
18@class {
19    GrColor4f constantOutputForConstantInput(GrColor4f input) const override {
20        return input.unpremul();
21    }
22}