Ethan Nicholas | 130fb3f | 2018-02-01 12:14:34 -0500 | [diff] [blame] | 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 | |
Ethan Nicholas | be0a042 | 2017-11-17 13:44:05 -0500 | [diff] [blame] | 8 | @optimizationFlags { |
| 9 | kPreservesOpaqueInput_OptimizationFlag | kConstantOutputForConstantInput_OptimizationFlag |
| 10 | } |
| 11 | |
| 12 | void main() { |
| 13 | sk_OutColor = sk_InColor; |
| 14 | sk_OutColor.rgb *= sk_InColor.a; |
| 15 | } |
| 16 | |
| 17 | @class { |
Brian Osman | 1d5b598 | 2018-10-01 13:41:39 -0400 | [diff] [blame] | 18 | SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& input) const override { |
| 19 | return SkColor4f { input.fR, input.fG, input.fB, input.fA }.premul(); |
Ethan Nicholas | be0a042 | 2017-11-17 13:44:05 -0500 | [diff] [blame] | 20 | } |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 21 | } |