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

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

Issue 1457543003: Add ShaderBuilders to EmitArgs and remove gettings from ProgBuilder. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrOvalRenderer.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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 const char* name() const override { return "Premultiply"; } 147 const char* name() const override { return "Premultiply"; }
148 148
149 private: 149 private:
150 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { 150 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
151 class GLFP : public GrGLSLFragmentProcessor { 151 class GLFP : public GrGLSLFragmentProcessor {
152 public: 152 public:
153 GLFP() {} 153 GLFP() {}
154 154
155 void emitCode(EmitArgs& args) override { 155 void emitCode(EmitArgs& args) override {
156 GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmen tShaderBuilder(); 156 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
157 this->emitChild(0, nullptr, args); 157 this->emitChild(0, nullptr, args);
158 fsBuilder->codeAppendf("%s.rgb *= %s.rgb;", args.fOutputColo r, 158 fragBuilder->codeAppendf("%s.rgb *= %s.rgb;", args.fOutputCo lor,
159 args.fInputColor ); 159 args.fInputColor );
160 fsBuilder->codeAppendf("%s *= %s.a;", args.fOutputColor, arg s.fInputColor); 160 fragBuilder->codeAppendf("%s *= %s.a;", args.fOutputColor, a rgs.fInputColor);
161 } 161 }
162 }; 162 };
163 return new GLFP; 163 return new GLFP;
164 } 164 }
165 165
166 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) co nst override {} 166 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) co nst override {}
167 167
168 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } 168 bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
169 169
170 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { 170 void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 369 }
370 } 370 }
371 371
372 if (1 == cnt) { 372 if (1 == cnt) {
373 return SkRef(series[0]); 373 return SkRef(series[0]);
374 } else { 374 } else {
375 return new SeriesFragmentProcessor(series, cnt); 375 return new SeriesFragmentProcessor(series, cnt);
376 } 376 }
377 } 377 }
378 378
OLDNEW
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698