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 GrAlphaThresholdFragmentProcessor.fp; do not modify. 10 **************************************************************************************************/ 11 #ifndef GrAlphaThresholdFragmentProcessor_DEFINED 12 #define GrAlphaThresholdFragmentProcessor_DEFINED 13 #include "include/core/SkTypes.h" 14 15 #include "src/gpu/GrCoordTransform.h" 16 #include "src/gpu/GrFragmentProcessor.h" 17 class GrAlphaThresholdFragmentProcessor : public GrFragmentProcessor { 18 public: 19 inline OptimizationFlags optFlags(float outerThreshold); 20 Make(sk_sp<GrTextureProxy> mask,float innerThreshold,float outerThreshold,const SkIRect & bounds)21 static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> mask, 22 float innerThreshold, 23 float outerThreshold, 24 const SkIRect& bounds) { 25 return std::unique_ptr<GrFragmentProcessor>(new GrAlphaThresholdFragmentProcessor( 26 mask, innerThreshold, outerThreshold, bounds)); 27 } 28 GrAlphaThresholdFragmentProcessor(const GrAlphaThresholdFragmentProcessor& src); 29 std::unique_ptr<GrFragmentProcessor> clone() const override; name()30 const char* name() const override { return "AlphaThresholdFragmentProcessor"; } 31 GrCoordTransform maskCoordTransform; 32 TextureSampler mask; 33 float innerThreshold; 34 float outerThreshold; 35 36 private: GrAlphaThresholdFragmentProcessor(sk_sp<GrTextureProxy> mask,float innerThreshold,float outerThreshold,const SkIRect & bounds)37 GrAlphaThresholdFragmentProcessor(sk_sp<GrTextureProxy> mask, float innerThreshold, 38 float outerThreshold, const SkIRect& bounds) 39 : INHERITED(kGrAlphaThresholdFragmentProcessor_ClassID, kNone_OptimizationFlags) 40 , maskCoordTransform( 41 SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())), 42 mask.get()) 43 , mask(std::move(mask)) 44 , innerThreshold(innerThreshold) 45 , outerThreshold(outerThreshold) { 46 this->setTextureSamplerCnt(1); 47 this->addCoordTransform(&maskCoordTransform); 48 } 49 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; 50 void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; 51 bool onIsEqual(const GrFragmentProcessor&) const override; 52 const TextureSampler& onTextureSampler(int) const override; 53 GR_DECLARE_FRAGMENT_PROCESSOR_TEST 54 typedef GrFragmentProcessor INHERITED; 55 }; 56 #endif 57