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