• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright 2017 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@class {
9    enum Mode {
10        kGaussian_Mode = 0,
11        kSmoothStep_Mode = 1
12    };
13}
14
15layout(key) in int mode;
16
17void main() {
18    float factor = 1.0 - sk_InColor.a;
19    @switch (mode) {
20        case 0: // kGaussian_Mode
21            factor = exp(-factor * factor * 4.0) - 0.018;
22            break;
23        case 1: // kSmoothstep_Mode
24            factor = smoothstep(1.0, 0.0, factor);
25            break;
26    }
27    sk_OutColor = vec4(factor);
28}
29