Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: src/gpu/GrFragmentProcessor.cpp

Issue 1666773002: Clean up GrGLSLFragmentProcessor-derived classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/gradients/SkGradientShaderPriv.h ('k') | src/gpu/effects/GrBicubicEffect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrFragmentProcessor.h" 9 #include "GrFragmentProcessor.h"
10 #include "GrCoordTransform.h" 10 #include "GrCoordTransform.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 this->initClassID<PremulFragmentProcessor>(); 145 this->initClassID<PremulFragmentProcessor>();
146 this->registerChildProcessor(processor); 146 this->registerChildProcessor(processor);
147 } 147 }
148 148
149 const char* name() const override { return "Premultiply"; } 149 const char* name() const override { return "Premultiply"; }
150 150
151 private: 151 private:
152 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { 152 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
153 class GLFP : public GrGLSLFragmentProcessor { 153 class GLFP : public GrGLSLFragmentProcessor {
154 public: 154 public:
155 GLFP() {}
156
157 void emitCode(EmitArgs& args) override { 155 void emitCode(EmitArgs& args) override {
158 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 156 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
159 this->emitChild(0, nullptr, args); 157 this->emitChild(0, nullptr, args);
160 fragBuilder->codeAppendf("%s.rgb *= %s.rgb;", args.fOutputCo lor, 158 fragBuilder->codeAppendf("%s.rgb *= %s.rgb;", args.fOutputCo lor,
161 args.fInputColor ); 159 args.fInputColor );
162 fragBuilder->codeAppendf("%s *= %s.a;", args.fOutputColor, a rgs.fInputColor); 160 fragBuilder->codeAppendf("%s *= %s.a;", args.fOutputColor, a rgs.fInputColor);
163 } 161 }
164 }; 162 };
165 return new GLFP; 163 return new GLFP;
166 } 164 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 for (int i = 0; i < cnt; ++i) { 295 for (int i = 0; i < cnt; ++i) {
298 this->registerChildProcessor(children[i]); 296 this->registerChildProcessor(children[i]);
299 } 297 }
300 } 298 }
301 299
302 const char* name() const override { return "Series"; } 300 const char* name() const override { return "Series"; }
303 301
304 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { 302 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
305 class GLFP : public GrGLSLFragmentProcessor { 303 class GLFP : public GrGLSLFragmentProcessor {
306 public: 304 public:
307 GLFP() {}
308 void emitCode(EmitArgs& args) override { 305 void emitCode(EmitArgs& args) override {
309 SkString input(args.fInputColor); 306 SkString input(args.fInputColor);
310 for (int i = 0; i < this->numChildProcessors() - 1; ++i) { 307 for (int i = 0; i < this->numChildProcessors() - 1; ++i) {
311 SkString temp; 308 SkString temp;
312 temp.printf("out%d", i); 309 temp.printf("out%d", i);
313 this->emitChild(i, input.c_str(), &temp, args); 310 this->emitChild(i, input.c_str(), &temp, args);
314 input = temp; 311 input = temp;
315 } 312 }
316 // Last guy writes to our output variable. 313 // Last guy writes to our output variable.
317 this->emitChild(this->numChildProcessors() - 1, input.c_str( ), args); 314 this->emitChild(this->numChildProcessors() - 1, input.c_str( ), args);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 369 }
373 } 370 }
374 371
375 if (1 == cnt) { 372 if (1 == cnt) {
376 return SkRef(series[0]); 373 return SkRef(series[0]);
377 } else { 374 } else {
378 return new SeriesFragmentProcessor(series, cnt); 375 return new SeriesFragmentProcessor(series, cnt);
379 } 376 }
380 } 377 }
381 378
OLDNEW
« no previous file with comments | « src/effects/gradients/SkGradientShaderPriv.h ('k') | src/gpu/effects/GrBicubicEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698