| 1 | /* | 
|---|---|
| 2 | * Copyright 2020 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 GrDitherEffect.fp; do not modify. | 
| 10 | **************************************************************************************************/ | 
| 11 | #ifndef GrDitherEffect_DEFINED | 
| 12 | #define GrDitherEffect_DEFINED | 
| 13 | |
| 14 | #include "include/core/SkM44.h" | 
| 15 | #include "include/core/SkTypes.h" | 
| 16 | |
| 17 | #include "src/gpu/GrFragmentProcessor.h" | 
| 18 | |
| 19 | class GrDitherEffect : public GrFragmentProcessor { | 
| 20 | public: | 
| 21 | static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> inputFP, | 
| 22 | float range) { | 
| 23 | if (range == 0.0 || inputFP == nullptr) { | 
| 24 | return inputFP; | 
| 25 | } | 
| 26 | return std::unique_ptr<GrFragmentProcessor>(new GrDitherEffect(std::move(inputFP), range)); | 
| 27 | } | 
| 28 | GrDitherEffect(const GrDitherEffect& src); | 
| 29 | std::unique_ptr<GrFragmentProcessor> clone() const override; | 
| 30 | const char* name() const override { return "DitherEffect"; } | 
| 31 | float range; | 
| 32 | |
| 33 | private: | 
| 34 | GrDitherEffect(std::unique_ptr<GrFragmentProcessor> inputFP, float range) | 
| 35 | : INHERITED(kGrDitherEffect_ClassID, | 
| 36 | (OptimizationFlags)(inputFP ? ProcessorOptimizationFlags(inputFP.get()) | 
| 37 | : kAll_OptimizationFlags) & | 
| 38 | kPreservesOpaqueInput_OptimizationFlag) | 
| 39 | , range(range) { | 
| 40 | SkASSERT(inputFP); | 
| 41 | this->registerChild(std::move(inputFP), SkSL::SampleUsage::PassThrough()); | 
| 42 | } | 
| 43 | GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; | 
| 44 | void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; | 
| 45 | bool onIsEqual(const GrFragmentProcessor&) const override; | 
| 46 | #if GR_TEST_UTILS | 
| 47 | SkString onDumpInfo() const override; | 
| 48 | #endif | 
| 49 | GR_DECLARE_FRAGMENT_PROCESSOR_TEST | 
| 50 | typedef GrFragmentProcessor INHERITED; | 
| 51 | }; | 
| 52 | #endif | 
| 53 | 
