| 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 | /************************************************************************************************** |
| 9 | *** This file was autogenerated from GrPremulInputFragmentProcessor.fp; do not modify. |
| 10 | **************************************************************************************************/ |
| 11 | #ifndef GrPremulInputFragmentProcessor_DEFINED |
| 12 | #define GrPremulInputFragmentProcessor_DEFINED |
| 13 | #include "include/core/SkTypes.h" |
| 14 | #include "include/core/SkM44.h" |
| 15 | |
| 16 | #include "src/gpu/GrCoordTransform.h" |
| 17 | #include "src/gpu/GrFragmentProcessor.h" |
| 18 | class GrPremulInputFragmentProcessor : public GrFragmentProcessor { |
| 19 | public: |
| 20 | SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& input) const override { |
| 21 | return SkColor4f{input.fR, input.fG, input.fB, input.fA}.premul(); |
| 22 | } |
| 23 | static std::unique_ptr<GrFragmentProcessor> Make() { |
| 24 | return std::unique_ptr<GrFragmentProcessor>(new GrPremulInputFragmentProcessor()); |
| 25 | } |
| 26 | GrPremulInputFragmentProcessor(const GrPremulInputFragmentProcessor& src); |
| 27 | std::unique_ptr<GrFragmentProcessor> clone() const override; |
| 28 | const char* name() const override { return "PremulInputFragmentProcessor"; } |
| 29 | |
| 30 | private: |
| 31 | GrPremulInputFragmentProcessor() |
| 32 | : INHERITED(kGrPremulInputFragmentProcessor_ClassID, |
| 33 | (OptimizationFlags)kPreservesOpaqueInput_OptimizationFlag | |
| 34 | kConstantOutputForConstantInput_OptimizationFlag) {} |
| 35 | GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
| 36 | void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; |
| 37 | bool onIsEqual(const GrFragmentProcessor&) const override; |
| 38 | GR_DECLARE_FRAGMENT_PROCESSOR_TEST |
| 39 | typedef GrFragmentProcessor INHERITED; |
| 40 | }; |
| 41 | #endif |
| 42 |