OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 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 #ifndef GrAlphaThresholdFragmentProcessor_DEFINED |
| 9 #define GrAlphaThresholdFragmentProcessor_DEFINED |
| 10 |
| 11 #include "SkTypes.h" |
| 12 |
| 13 #if SK_SUPPORT_GPU |
| 14 |
| 15 #include "GrCoordTransform.h" |
| 16 #include "GrFragmentProcessor.h" |
| 17 #include "GrProcessorUnitTest.h" |
| 18 |
| 19 class GrAlphaThresholdFragmentProcessor : public GrFragmentProcessor { |
| 20 |
| 21 public: |
| 22 static sk_sp<GrFragmentProcessor> Make(GrTexture* texture, |
| 23 GrTexture* maskTexture, |
| 24 float innerThreshold, |
| 25 float outerThreshold, |
| 26 const SkIRect& bounds); |
| 27 |
| 28 const char* name() const override { return "Alpha Threshold"; } |
| 29 |
| 30 float innerThreshold() const { return fInnerThreshold; } |
| 31 float outerThreshold() const { return fOuterThreshold; } |
| 32 |
| 33 private: |
| 34 GrAlphaThresholdFragmentProcessor(GrTexture* texture, |
| 35 GrTexture* maskTexture, |
| 36 float innerThreshold, |
| 37 float outerThreshold, |
| 38 const SkIRect& bounds); |
| 39 |
| 40 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
| 41 |
| 42 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const
override; |
| 43 |
| 44 bool onIsEqual(const GrFragmentProcessor&) const override; |
| 45 |
| 46 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
| 47 |
| 48 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| 49 |
| 50 float fInnerThreshold; |
| 51 float fOuterThreshold; |
| 52 GrCoordTransform fImageCoordTransform; |
| 53 GrTextureAccess fImageTextureAccess; |
| 54 GrCoordTransform fMaskCoordTransform; |
| 55 GrTextureAccess fMaskTextureAccess; |
| 56 |
| 57 typedef GrFragmentProcessor INHERITED; |
| 58 }; |
| 59 |
| 60 #endif |
| 61 #endif |
OLD | NEW |