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