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