• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 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 GrOverrideInputFragmentProcessor.fp; do not modify.
10  **************************************************************************************************/
11 #ifndef GrOverrideInputFragmentProcessor_DEFINED
12 #define GrOverrideInputFragmentProcessor_DEFINED
13 #include "include/core/SkTypes.h"
14 
15 #include "src/gpu/GrCoordTransform.h"
16 #include "src/gpu/GrFragmentProcessor.h"
17 class GrOverrideInputFragmentProcessor : public GrFragmentProcessor {
18 public:
OptFlags(const std::unique_ptr<GrFragmentProcessor> & fp,const SkPMColor4f & color)19     static OptimizationFlags OptFlags(const std::unique_ptr<GrFragmentProcessor>& fp,
20                                       const SkPMColor4f& color) {
21         auto childFlags = ProcessorOptimizationFlags(fp.get());
22         auto flags = kNone_OptimizationFlags;
23         if (childFlags & kConstantOutputForConstantInput_OptimizationFlag) {
24             flags |= kConstantOutputForConstantInput_OptimizationFlag;
25         }
26         if ((childFlags & kPreservesOpaqueInput_OptimizationFlag) && color.isOpaque()) {
27             flags |= kPreservesOpaqueInput_OptimizationFlag;
28         }
29         return flags;
30     }
31 
constantOutputForConstantInput(const SkPMColor4f & input)32     SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& input) const override {
33         return ConstantOutputForConstantInput(this->childProcessor(0), uniformColor);
34     }
35 
36     static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> fp,
37                                                      const SkPMColor4f& color,
38                                                      bool useUniform = true) {
39         return std::unique_ptr<GrFragmentProcessor>(
40                 new GrOverrideInputFragmentProcessor(std::move(fp), useUniform, color, color));
41     }
42     GrOverrideInputFragmentProcessor(const GrOverrideInputFragmentProcessor& src);
43     std::unique_ptr<GrFragmentProcessor> clone() const override;
name()44     const char* name() const override { return "OverrideInputFragmentProcessor"; }
45     int fp_index = -1;
46     bool useUniform;
47     SkPMColor4f uniformColor;
48     SkPMColor4f literalColor;
49 
50 private:
GrOverrideInputFragmentProcessor(std::unique_ptr<GrFragmentProcessor> fp,bool useUniform,SkPMColor4f uniformColor,SkPMColor4f literalColor)51     GrOverrideInputFragmentProcessor(std::unique_ptr<GrFragmentProcessor> fp,
52                                      bool useUniform,
53                                      SkPMColor4f uniformColor,
54                                      SkPMColor4f literalColor)
55             : INHERITED(kGrOverrideInputFragmentProcessor_ClassID,
56                         (OptimizationFlags)OptFlags(fp, useUniform ? uniformColor : literalColor))
57             , useUniform(useUniform)
58             , uniformColor(uniformColor)
59             , literalColor(literalColor) {
60         SkASSERT(fp);
61         fp_index = this->numChildProcessors();
62         this->registerChildProcessor(std::move(fp));
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