| /* |
| * Copyright 2018 Google Inc. |
| * |
| * Use of this source code is governed by a BSD-style license that can be |
| * found in the LICENSE file. |
| */ |
| |
| /************************************************************************************************** |
| *** This file was autogenerated from GrAlphaThresholdFragmentProcessor.fp; do not modify. |
| **************************************************************************************************/ |
| #ifndef GrAlphaThresholdFragmentProcessor_DEFINED |
| #define GrAlphaThresholdFragmentProcessor_DEFINED |
| #include "SkTypes.h" |
| #if SK_SUPPORT_GPU |
| #include "GrFragmentProcessor.h" |
| #include "GrCoordTransform.h" |
| class GrAlphaThresholdFragmentProcessor : public GrFragmentProcessor { |
| public: |
| inline OptimizationFlags optFlags(float outerThreshold); |
| float innerThreshold() const { return fInnerThreshold; } |
| float outerThreshold() const { return fOuterThreshold; } |
| |
| static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> mask, |
| float innerThreshold, |
| float outerThreshold, |
| const SkIRect& bounds) { |
| return std::unique_ptr<GrFragmentProcessor>(new GrAlphaThresholdFragmentProcessor( |
| mask, innerThreshold, outerThreshold, bounds)); |
| } |
| GrAlphaThresholdFragmentProcessor(const GrAlphaThresholdFragmentProcessor& src); |
| std::unique_ptr<GrFragmentProcessor> clone() const override; |
| const char* name() const override { return "AlphaThresholdFragmentProcessor"; } |
| |
| private: |
| GrAlphaThresholdFragmentProcessor(sk_sp<GrTextureProxy> mask, float innerThreshold, |
| float outerThreshold, const SkIRect& bounds) |
| : INHERITED(kGrAlphaThresholdFragmentProcessor_ClassID, kNone_OptimizationFlags) |
| , fMask(std::move(mask)) |
| , fInnerThreshold(innerThreshold) |
| , fOuterThreshold(outerThreshold) |
| , fMaskCoordTransform( |
| SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())), |
| fMask.proxy()) { |
| this->addTextureSampler(&fMask); |
| this->addCoordTransform(&fMaskCoordTransform); |
| } |
| GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
| void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; |
| bool onIsEqual(const GrFragmentProcessor&) const override; |
| GR_DECLARE_FRAGMENT_PROCESSOR_TEST |
| TextureSampler fMask; |
| float fInnerThreshold; |
| float fOuterThreshold; |
| GrCoordTransform fMaskCoordTransform; |
| typedef GrFragmentProcessor INHERITED; |
| }; |
| #endif |
| #endif |