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 | |
14 | #include "include/core/SkM44.h" |
15 | #include "include/core/SkTypes.h" |
16 | |
17 | #include "src/gpu/GrFragmentProcessor.h" |
18 | |
19 | class GrMixerEffect : public GrFragmentProcessor { |
20 | public: |
21 | SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& in) const override { |
22 | const SkPMColor4f inColor = ConstantOutputForConstantInput(this->childProcessor(0), in); |
23 | const SkPMColor4f c0 = ConstantOutputForConstantInput(this->childProcessor(1), inColor); |
24 | const SkPMColor4f c1 = ConstantOutputForConstantInput(this->childProcessor(2), inColor); |
25 | return {c0.fR + (c1.fR - c0.fR) * weight, c0.fG + (c1.fG - c0.fG) * weight, |
26 | c0.fB + (c1.fB - c0.fB) * weight, c0.fA + (c1.fA - c0.fA) * weight}; |
27 | } |
28 | static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> inputFP, |
29 | std::unique_ptr<GrFragmentProcessor> fp0, |
30 | std::unique_ptr<GrFragmentProcessor> fp1, |
31 | float weight) { |
32 | return std::unique_ptr<GrFragmentProcessor>( |
33 | new GrMixerEffect(std::move(inputFP), std::move(fp0), std::move(fp1), weight)); |
34 | } |
35 | GrMixerEffect(const GrMixerEffect& src); |
36 | std::unique_ptr<GrFragmentProcessor> clone() const override; |
37 | const char* name() const override { return "MixerEffect" ; } |
38 | float weight; |
39 | |
40 | private: |
41 | GrMixerEffect(std::unique_ptr<GrFragmentProcessor> inputFP, |
42 | std::unique_ptr<GrFragmentProcessor> fp0, |
43 | std::unique_ptr<GrFragmentProcessor> fp1, |
44 | float weight) |
45 | : INHERITED(kGrMixerEffect_ClassID, |
46 | (OptimizationFlags)ProcessorOptimizationFlags(inputFP.get()) & |
47 | ProcessorOptimizationFlags(fp1.get()) & |
48 | ProcessorOptimizationFlags(fp0.get())) |
49 | , weight(weight) { |
50 | this->registerChild(std::move(inputFP), SkSL::SampleUsage::PassThrough()); |
51 | SkASSERT(fp0); |
52 | this->registerChild(std::move(fp0), SkSL::SampleUsage::PassThrough()); |
53 | this->registerChild(std::move(fp1), SkSL::SampleUsage::PassThrough()); |
54 | } |
55 | GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
56 | void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; |
57 | bool onIsEqual(const GrFragmentProcessor&) const override; |
58 | #if GR_TEST_UTILS |
59 | SkString onDumpInfo() const override; |
60 | #endif |
61 | GR_DECLARE_FRAGMENT_PROCESSOR_TEST |
62 | typedef GrFragmentProcessor INHERITED; |
63 | }; |
64 | #endif |
65 | |