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: Make(std::unique_ptr<GrFragmentProcessor> inputFP,float range)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; name()30 const char* name() const override { return "DitherEffect"; } 31 float range; 32 33 private: GrDitherEffect(std::unique_ptr<GrFragmentProcessor> inputFP,float range)34 GrDitherEffect(std::unique_ptr<GrFragmentProcessor> inputFP, float range) 35 : INHERITED(kGrDitherEffect_ClassID, 36 (OptimizationFlags)ProcessorOptimizationFlags(inputFP.get()) & 37 kPreservesOpaqueInput_OptimizationFlag) 38 , range(range) { 39 this->registerChild(std::move(inputFP), SkSL::SampleUsage::PassThrough()); 40 } 41 std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override; 42 void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; 43 bool onIsEqual(const GrFragmentProcessor&) const override; 44 #if GR_TEST_UTILS 45 SkString onDumpInfo() const override; 46 #endif 47 GR_DECLARE_FRAGMENT_PROCESSOR_TEST 48 using INHERITED = GrFragmentProcessor; 49 }; 50 #endif 51