• 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 GrMixerEffect.fp; do not modify.
10  **************************************************************************************************/
11 #ifndef GrMixerEffect_DEFINED
12 #define GrMixerEffect_DEFINED
13 #include "include/core/SkTypes.h"
14 
15 #include "src/gpu/GrCoordTransform.h"
16 #include "src/gpu/GrFragmentProcessor.h"
17 class GrMixerEffect : public GrFragmentProcessor {
18 public:
OptFlags(const std::unique_ptr<GrFragmentProcessor> & fp0,const std::unique_ptr<GrFragmentProcessor> & fp1)19     static OptimizationFlags OptFlags(const std::unique_ptr<GrFragmentProcessor>& fp0,
20                                       const std::unique_ptr<GrFragmentProcessor>& fp1) {
21         auto flags = ProcessorOptimizationFlags(fp0.get());
22         if (fp1) {
23             flags &= ProcessorOptimizationFlags(fp1.get());
24         }
25         return flags;
26     }
27 
constantOutputForConstantInput(const SkPMColor4f & input)28     SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& input) const override {
29         const auto c0 = ConstantOutputForConstantInput(this->childProcessor(0), input),
30                    c1 = (this->numChildProcessors() > 1)
31                                 ? ConstantOutputForConstantInput(this->childProcessor(1), input)
32                                 : input;
33         return {c0.fR + (c1.fR - c0.fR) * weight, c0.fG + (c1.fG - c0.fG) * weight,
34                 c0.fB + (c1.fB - c0.fB) * weight, c0.fA + (c1.fA - c0.fA) * weight};
35     }
Make(std::unique_ptr<GrFragmentProcessor> fp0,std::unique_ptr<GrFragmentProcessor> fp1,float weight)36     static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> fp0,
37                                                      std::unique_ptr<GrFragmentProcessor>
38                                                              fp1,
39                                                      float weight) {
40         return std::unique_ptr<GrFragmentProcessor>(
41                 new GrMixerEffect(std::move(fp0), std::move(fp1), weight));
42     }
43     GrMixerEffect(const GrMixerEffect& src);
44     std::unique_ptr<GrFragmentProcessor> clone() const override;
name()45     const char* name() const override { return "MixerEffect"; }
46     int fp0_index = -1;
47     int fp1_index = -1;
48     float weight;
49 
50 private:
GrMixerEffect(std::unique_ptr<GrFragmentProcessor> fp0,std::unique_ptr<GrFragmentProcessor> fp1,float weight)51     GrMixerEffect(std::unique_ptr<GrFragmentProcessor> fp0,
52                   std::unique_ptr<GrFragmentProcessor>
53                           fp1,
54                   float weight)
55             : INHERITED(kGrMixerEffect_ClassID, (OptimizationFlags)OptFlags(fp0, fp1))
56             , weight(weight) {
57         SkASSERT(fp0);
58         fp0_index = this->numChildProcessors();
59         this->registerChildProcessor(std::move(fp0));
60         if (fp1) {
61             fp1_index = this->numChildProcessors();
62             this->registerChildProcessor(std::move(fp1));
63         }
64     }
65     GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
66     void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
67     bool onIsEqual(const GrFragmentProcessor&) const override;
68     GR_DECLARE_FRAGMENT_PROCESSOR_TEST
69     typedef GrFragmentProcessor INHERITED;
70 };
71 #endif
72