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 #include "SkTypes.h"
14 #include "GrFragmentProcessor.h"
15 #include "GrCoordTransform.h"
16 class GrClampedGradientEffect : public GrFragmentProcessor {
17 public:
colorizer_index()18     int colorizer_index() const { return fColorizer_index; }
gradLayout_index()19     int gradLayout_index() const { return fGradLayout_index; }
leftBorderColor()20     const SkPMColor4f& leftBorderColor() const { return fLeftBorderColor; }
rightBorderColor()21     const SkPMColor4f& rightBorderColor() const { return fRightBorderColor; }
makePremul()22     bool makePremul() const { return fMakePremul; }
colorsAreOpaque()23     bool colorsAreOpaque() const { return fColorsAreOpaque; }
Make(std::unique_ptr<GrFragmentProcessor> colorizer,std::unique_ptr<GrFragmentProcessor> gradLayout,SkPMColor4f leftBorderColor,SkPMColor4f rightBorderColor,bool makePremul,bool colorsAreOpaque)24     static std::unique_ptr<GrFragmentProcessor> Make(
25             std::unique_ptr<GrFragmentProcessor> colorizer,
26             std::unique_ptr<GrFragmentProcessor> gradLayout, SkPMColor4f leftBorderColor,
27             SkPMColor4f rightBorderColor, bool makePremul, 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;
name()34     const char* name() const override { return "ClampedGradientEffect"; }
35 
36 private:
GrClampedGradientEffect(std::unique_ptr<GrFragmentProcessor> colorizer,std::unique_ptr<GrFragmentProcessor> gradLayout,SkPMColor4f leftBorderColor,SkPMColor4f rightBorderColor,bool makePremul,bool colorsAreOpaque)37     GrClampedGradientEffect(std::unique_ptr<GrFragmentProcessor> colorizer,
38                             std::unique_ptr<GrFragmentProcessor> gradLayout,
39                             SkPMColor4f leftBorderColor, SkPMColor4f rightBorderColor,
40                             bool makePremul, bool colorsAreOpaque)
41             : INHERITED(kGrClampedGradientEffect_ClassID,
42                         (OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag |
43                                 (colorsAreOpaque && gradLayout->preservesOpaqueInput()
44                                          ? kPreservesOpaqueInput_OptimizationFlag
45                                          : kNone_OptimizationFlags))
46             , fLeftBorderColor(leftBorderColor)
47             , fRightBorderColor(rightBorderColor)
48             , fMakePremul(makePremul)
49             , fColorsAreOpaque(colorsAreOpaque) {
50         SkASSERT(colorizer);
51         fColorizer_index = this->numChildProcessors();
52         this->registerChildProcessor(std::move(colorizer));
53         SkASSERT(gradLayout);
54         fGradLayout_index = this->numChildProcessors();
55         this->registerChildProcessor(std::move(gradLayout));
56     }
57     GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
58     void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
59     bool onIsEqual(const GrFragmentProcessor&) const override;
60     GR_DECLARE_FRAGMENT_PROCESSOR_TEST
61     int fColorizer_index = -1;
62     int fGradLayout_index = -1;
63     SkPMColor4f fLeftBorderColor;
64     SkPMColor4f fRightBorderColor;
65     bool fMakePremul;
66     bool fColorsAreOpaque;
67     typedef GrFragmentProcessor INHERITED;
68 };
69 #endif
70