1 /* 2 * Copyright 2017 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 16 #include "GrColorSpaceXform.h" 17 #include "GrFragmentProcessor.h" 18 #include "GrCoordTransform.h" 19 #include "GrColorSpaceXform.h" 20 #include "effects/GrProxyMove.h" 21 class GrAlphaThresholdFragmentProcessor : public GrFragmentProcessor { 22 public: 23 inline OptimizationFlags optFlags(float outerThreshold); 24 sk_sp<GrColorSpaceXform> colorXform() const { return fColorXform; } 25 float innerThreshold() const { return fInnerThreshold; } 26 float outerThreshold() const { return fOuterThreshold; } 27 28 static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> image, 29 sk_sp<GrColorSpaceXform> 30 colorXform, 31 sk_sp<GrTextureProxy> 32 mask, 33 float innerThreshold, 34 float outerThreshold, 35 const SkIRect& bounds) { 36 return sk_sp<GrFragmentProcessor>(new GrAlphaThresholdFragmentProcessor( 37 image, colorXform, mask, innerThreshold, outerThreshold, bounds)); 38 } 39 const char* name() const override { return "AlphaThresholdFragmentProcessor"; } 40 41 private: 42 GrAlphaThresholdFragmentProcessor(sk_sp<GrTextureProxy> image, 43 sk_sp<GrColorSpaceXform> colorXform, 44 sk_sp<GrTextureProxy> mask, float innerThreshold, 45 float outerThreshold, const SkIRect& bounds) 46 : INHERITED(kNone_OptimizationFlags) 47 , fImage(std::move(image)) 48 , fColorXform(colorXform) 49 , fMask(std::move(mask)) 50 , fInnerThreshold(innerThreshold) 51 , fOuterThreshold(outerThreshold) 52 , fImageCoordTransform(SkMatrix::I(), fImage.proxy()) 53 , fMaskCoordTransform( 54 SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())), 55 fMask.proxy()) { 56 this->addTextureSampler(&fImage); 57 this->addTextureSampler(&fMask); 58 this->addCoordTransform(&fImageCoordTransform); 59 this->addCoordTransform(&fMaskCoordTransform); 60 this->initClassID<GrAlphaThresholdFragmentProcessor>(); 61 } 62 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; 63 void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; 64 bool onIsEqual(const GrFragmentProcessor&) const override; 65 GR_DECLARE_FRAGMENT_PROCESSOR_TEST 66 TextureSampler fImage; 67 sk_sp<GrColorSpaceXform> fColorXform; 68 TextureSampler fMask; 69 float fInnerThreshold; 70 float fOuterThreshold; 71 GrCoordTransform fImageCoordTransform; 72 GrCoordTransform fMaskCoordTransform; 73 typedef GrFragmentProcessor INHERITED; 74 }; 75 #endif 76 #endif 77