• 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
8enum class Mode {
9    kGaussian   = 0,
10    kSmoothStep = 1
11};
12
13layout(key) in Mode mode;
14
15void main() {
16    half factor = 1.0 - sk_InColor.a;
17    @switch (mode) {
18        case Mode::kGaussian:
19            factor = half(exp(-factor * factor * 4.0) - 0.018);
20            break;
21        case Mode::kSmoothStep:
22            factor = smoothstep(1.0, 0.0, factor);
23            break;
24    }
25    sk_OutColor = half4(factor);
26}
27