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 GrClampedGradientEffect.fp; do not modify. |
10 | **************************************************************************************************/ |
11 | #ifndef GrClampedGradientEffect_DEFINED |
12 | #define GrClampedGradientEffect_DEFINED |
13 | |
14 | #include "include/core/SkM44.h" |
15 | #include "include/core/SkTypes.h" |
16 | |
17 | #include "src/gpu/GrFragmentProcessor.h" |
18 | |
19 | class GrClampedGradientEffect : public GrFragmentProcessor { |
20 | public: |
21 | static std::unique_ptr<GrFragmentProcessor> Make( |
22 | std::unique_ptr<GrFragmentProcessor> colorizer, |
23 | std::unique_ptr<GrFragmentProcessor> gradLayout, |
24 | SkPMColor4f leftBorderColor, |
25 | SkPMColor4f rightBorderColor, |
26 | bool makePremul, |
27 | bool colorsAreOpaque) { |
28 | return std::unique_ptr<GrFragmentProcessor>(new GrClampedGradientEffect( |
29 | std::move(colorizer), std::move(gradLayout), leftBorderColor, rightBorderColor, |
30 | makePremul, colorsAreOpaque)); |
31 | } |
32 | GrClampedGradientEffect(const GrClampedGradientEffect& src); |
33 | std::unique_ptr<GrFragmentProcessor> clone() const override; |
34 | const char* name() const override { return "ClampedGradientEffect" ; } |
35 | SkPMColor4f leftBorderColor; |
36 | SkPMColor4f rightBorderColor; |
37 | bool makePremul; |
38 | bool colorsAreOpaque; |
39 | |
40 | private: |
41 | GrClampedGradientEffect(std::unique_ptr<GrFragmentProcessor> colorizer, |
42 | std::unique_ptr<GrFragmentProcessor> gradLayout, |
43 | SkPMColor4f leftBorderColor, |
44 | SkPMColor4f rightBorderColor, |
45 | bool makePremul, |
46 | bool colorsAreOpaque) |
47 | : INHERITED(kGrClampedGradientEffect_ClassID, |
48 | (OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag | |
49 | (colorsAreOpaque && gradLayout->preservesOpaqueInput() |
50 | ? kPreservesOpaqueInput_OptimizationFlag |
51 | : kNone_OptimizationFlags)) |
52 | , leftBorderColor(leftBorderColor) |
53 | , rightBorderColor(rightBorderColor) |
54 | , makePremul(makePremul) |
55 | , colorsAreOpaque(colorsAreOpaque) { |
56 | SkASSERT(colorizer); |
57 | this->registerChild(std::move(colorizer), SkSL::SampleUsage::Explicit()); |
58 | SkASSERT(gradLayout); |
59 | this->registerChild(std::move(gradLayout), SkSL::SampleUsage::PassThrough()); |
60 | } |
61 | GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
62 | void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; |
63 | bool onIsEqual(const GrFragmentProcessor&) const override; |
64 | #if GR_TEST_UTILS |
65 | SkString onDumpInfo() const override; |
66 | #endif |
67 | GR_DECLARE_FRAGMENT_PROCESSOR_TEST |
68 | typedef GrFragmentProcessor INHERITED; |
69 | }; |
70 | #endif |
71 | |