• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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:
Make(std::unique_ptr<GrFragmentProcessor> colorizer,std::unique_ptr<GrFragmentProcessor> gradLayout,SkPMColor4f leftBorderColor,SkPMColor4f rightBorderColor,bool makePremul,bool colorsAreOpaque)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         bool layoutPreservesOpacity = gradLayout->preservesOpaqueInput();
29         return std::unique_ptr<GrFragmentProcessor>(
30                 new GrClampedGradientEffect(std::move(colorizer),
31                                             std::move(gradLayout),
32                                             leftBorderColor,
33                                             rightBorderColor,
34                                             makePremul,
35                                             colorsAreOpaque,
36                                             layoutPreservesOpacity));
37     }
38     GrClampedGradientEffect(const GrClampedGradientEffect& src);
39     std::unique_ptr<GrFragmentProcessor> clone() const override;
name()40     const char* name() const override { return "ClampedGradientEffect"; }
41     SkPMColor4f leftBorderColor;
42     SkPMColor4f rightBorderColor;
43     bool makePremul;
44     bool colorsAreOpaque;
45     bool layoutPreservesOpacity;
46 
47 private:
GrClampedGradientEffect(std::unique_ptr<GrFragmentProcessor> colorizer,std::unique_ptr<GrFragmentProcessor> gradLayout,SkPMColor4f leftBorderColor,SkPMColor4f rightBorderColor,bool makePremul,bool colorsAreOpaque,bool layoutPreservesOpacity)48     GrClampedGradientEffect(std::unique_ptr<GrFragmentProcessor> colorizer,
49                             std::unique_ptr<GrFragmentProcessor> gradLayout,
50                             SkPMColor4f leftBorderColor,
51                             SkPMColor4f rightBorderColor,
52                             bool makePremul,
53                             bool colorsAreOpaque,
54                             bool layoutPreservesOpacity)
55             : INHERITED(kGrClampedGradientEffect_ClassID,
56                         (OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag |
57                                 (colorsAreOpaque && layoutPreservesOpacity
58                                          ? kPreservesOpaqueInput_OptimizationFlag
59                                          : kNone_OptimizationFlags))
60             , leftBorderColor(leftBorderColor)
61             , rightBorderColor(rightBorderColor)
62             , makePremul(makePremul)
63             , colorsAreOpaque(colorsAreOpaque)
64             , layoutPreservesOpacity(layoutPreservesOpacity) {
65         this->registerChild(std::move(colorizer), SkSL::SampleUsage::Explicit());
66         this->registerChild(std::move(gradLayout), SkSL::SampleUsage::PassThrough());
67     }
68     std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
69     void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
70     bool onIsEqual(const GrFragmentProcessor&) const override;
71 #if GR_TEST_UTILS
72     SkString onDumpInfo() const override;
73 #endif
74     GR_DECLARE_FRAGMENT_PROCESSOR_TEST
75     using INHERITED = GrFragmentProcessor;
76 };
77 #endif
78