1/*
2 * Copyright 2019 Google LLC
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
9@optimizationFlags {
10    kConstantOutputForConstantInput_OptimizationFlag |
11    kPreservesOpaqueInput_OptimizationFlag
12}
13
14void main() { sk_OutColor = saturate(sk_InColor); }
15
16@class {
17    SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& input) const override {
18        return {SkTPin(input.fR, 0.f, 1.f),
19                SkTPin(input.fG, 0.f, 1.f),
20                SkTPin(input.fB, 0.f, 1.f),
21                SkTPin(input.fA, 0.f, 1.f)};
22    }
23}
24
25@test(d) { return GrSaturateProcessor::Make(); }
26