OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrFragmentProcessor.h" | 8 #include "GrFragmentProcessor.h" |
9 #include "GrCoordTransform.h" | 9 #include "GrCoordTransform.h" |
10 #include "GrInvariantOutput.h" | 10 #include "GrInvariantOutput.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 if (!child->fTextureAccesses.empty()) { | 99 if (!child->fTextureAccesses.empty()) { |
100 fTextureAccesses.push_back_n(child->fTextureAccesses.count(), | 100 fTextureAccesses.push_back_n(child->fTextureAccesses.count(), |
101 child->fTextureAccesses.begin()); | 101 child->fTextureAccesses.begin()); |
102 } | 102 } |
103 | 103 |
104 this->combineRequiredFeatures(*child); | 104 this->combineRequiredFeatures(*child); |
105 | 105 |
106 if (child->usesLocalCoords()) { | 106 if (child->usesLocalCoords()) { |
107 fUsesLocalCoords = true; | 107 fUsesLocalCoords = true; |
108 } | 108 } |
109 if (child->usesDistanceVectorField()) { | |
110 fUsesDistanceVectorField = true; | |
111 } | |
109 | 112 |
110 int index = fChildProcessors.count(); | 113 int index = fChildProcessors.count(); |
111 fChildProcessors.push_back(child.release()); | 114 fChildProcessors.push_back(child.release()); |
112 | 115 |
113 return index; | 116 return index; |
114 } | 117 } |
115 | 118 |
116 void GrFragmentProcessor::notifyRefCntIsZero() const { | 119 void GrFragmentProcessor::notifyRefCntIsZero() const { |
117 // See comment above GrProgramElement for a detailed explanation of why we d o this. | 120 // See comment above GrProgramElement for a detailed explanation of why we d o this. |
118 for (int i = 0; i < fChildProcessors.count(); ++i) { | 121 for (int i = 0; i < fChildProcessors.count(); ++i) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 const char* name() const override { return "PremultiplyInput"; } | 157 const char* name() const override { return "PremultiplyInput"; } |
155 | 158 |
156 private: | 159 private: |
157 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { | 160 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { |
158 class GLFP : public GrGLSLFragmentProcessor { | 161 class GLFP : public GrGLSLFragmentProcessor { |
159 public: | 162 public: |
160 void emitCode(EmitArgs& args) override { | 163 void emitCode(EmitArgs& args) override { |
161 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; | 164 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; |
162 | 165 |
163 fragBuilder->codeAppendf("%s = %s;", args.fOutputColor, args .fInputColor); | 166 fragBuilder->codeAppendf("%s = %s;", args.fOutputColor, args .fInputColor); |
164 fragBuilder->codeAppendf("%s.rgb *= %s.a;", args.fOutputColo r, args.fInputColor); | 167 fragBuilder->codeAppendf("%s.rgb *= %s.a;", args.fOutputColo r, args.fInputColor); |
egdaniel
2016/07/13 19:27:27
100 chars
dvonbeck
2016/07/13 21:28:14
Done.
| |
165 } | 168 } |
166 }; | 169 }; |
167 return new GLFP; | 170 return new GLFP; |
168 } | 171 } |
169 | 172 |
170 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) co nst override {} | 173 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) co nst override {} |
171 | 174 |
172 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } | 175 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } |
173 | 176 |
174 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { | 177 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 } else { | 412 } else { |
410 series += firstIdx; | 413 series += firstIdx; |
411 cnt -= firstIdx; | 414 cnt -= firstIdx; |
412 } | 415 } |
413 | 416 |
414 if (1 == cnt) { | 417 if (1 == cnt) { |
415 return series[0]; | 418 return series[0]; |
416 } | 419 } |
417 return sk_sp<GrFragmentProcessor>(new SeriesFragmentProcessor(series, cnt)); | 420 return sk_sp<GrFragmentProcessor>(new SeriesFragmentProcessor(series, cnt)); |
418 } | 421 } |
OLD | NEW |