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 GrClampedGradientEffect.fp; do not modify. 10 **************************************************************************************************/ 11 #ifndef GrClampedGradientEffect_DEFINED 12 #define GrClampedGradientEffect_DEFINED 13 #include "include/core/SkTypes.h" 14 15 #include "src/gpu/GrCoordTransform.h" 16 #include "src/gpu/GrFragmentProcessor.h" 17 class GrClampedGradientEffect : public GrFragmentProcessor { 18 public: Make(std::unique_ptr<GrFragmentProcessor> colorizer,std::unique_ptr<GrFragmentProcessor> gradLayout,SkPMColor4f leftBorderColor,SkPMColor4f rightBorderColor,bool makePremul,bool colorsAreOpaque)19 static std::unique_ptr<GrFragmentProcessor> Make( 20 std::unique_ptr<GrFragmentProcessor> colorizer, 21 std::unique_ptr<GrFragmentProcessor> gradLayout, SkPMColor4f leftBorderColor, 22 SkPMColor4f rightBorderColor, bool makePremul, bool colorsAreOpaque) { 23 return std::unique_ptr<GrFragmentProcessor>(new GrClampedGradientEffect( 24 std::move(colorizer), std::move(gradLayout), leftBorderColor, rightBorderColor, 25 makePremul, colorsAreOpaque)); 26 } 27 GrClampedGradientEffect(const GrClampedGradientEffect& src); 28 std::unique_ptr<GrFragmentProcessor> clone() const override; name()29 const char* name() const override { return "ClampedGradientEffect"; } 30 int colorizer_index = -1; 31 int gradLayout_index = -1; 32 SkPMColor4f leftBorderColor; 33 SkPMColor4f rightBorderColor; 34 bool makePremul; 35 bool colorsAreOpaque; 36 37 private: GrClampedGradientEffect(std::unique_ptr<GrFragmentProcessor> colorizer,std::unique_ptr<GrFragmentProcessor> gradLayout,SkPMColor4f leftBorderColor,SkPMColor4f rightBorderColor,bool makePremul,bool colorsAreOpaque)38 GrClampedGradientEffect(std::unique_ptr<GrFragmentProcessor> colorizer, 39 std::unique_ptr<GrFragmentProcessor> gradLayout, 40 SkPMColor4f leftBorderColor, SkPMColor4f rightBorderColor, 41 bool makePremul, bool colorsAreOpaque) 42 : INHERITED(kGrClampedGradientEffect_ClassID, 43 (OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag | 44 (colorsAreOpaque && gradLayout->preservesOpaqueInput() 45 ? kPreservesOpaqueInput_OptimizationFlag 46 : kNone_OptimizationFlags)) 47 , leftBorderColor(leftBorderColor) 48 , rightBorderColor(rightBorderColor) 49 , makePremul(makePremul) 50 , colorsAreOpaque(colorsAreOpaque) { 51 SkASSERT(colorizer); 52 colorizer_index = this->numChildProcessors(); 53 this->registerChildProcessor(std::move(colorizer)); 54 SkASSERT(gradLayout); 55 gradLayout_index = this->numChildProcessors(); 56 this->registerChildProcessor(std::move(gradLayout)); 57 } 58 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; 59 void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; 60 bool onIsEqual(const GrFragmentProcessor&) const override; 61 GR_DECLARE_FRAGMENT_PROCESSOR_TEST 62 typedef GrFragmentProcessor INHERITED; 63 }; 64 #endif 65