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

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

Issue 1684063006: Add GrShaderFlags enum (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Bit->Flag 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/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrPathProcessor.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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 219 }
220 220
221 const char* name() const override { return "Replace Color"; } 221 const char* name() const override { return "Replace Color"; }
222 222
223 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { 223 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
224 class GLFP : public GrGLSLFragmentProcessor { 224 class GLFP : public GrGLSLFragmentProcessor {
225 public: 225 public:
226 GLFP() : fHaveSetColor(false) {} 226 GLFP() : fHaveSetColor(false) {}
227 void emitCode(EmitArgs& args) override { 227 void emitCode(EmitArgs& args) override {
228 const char* colorName; 228 const char* colorName;
229 fColorUni = args.fUniformHandler->addUniform( 229 fColorUni = args.fUniformHandler->addUniform(kFragment_GrSha derFlag,
230 GrGLSLUniformHandler::k Fragment_Visibility, 230 kVec4f_GrSLType ,
231 kVec4f_GrSLType, kDefau lt_GrSLPrecision, 231 kDefault_GrSLPr ecision,
232 "Color", &colorName); 232 "Color", &color Name);
233 this->emitChild(0, colorName, args); 233 this->emitChild(0, colorName, args);
234 } 234 }
235 235
236 private: 236 private:
237 void onSetData(const GrGLSLProgramDataManager& pdman, 237 void onSetData(const GrGLSLProgramDataManager& pdman,
238 const GrProcessor& fp) override { 238 const GrProcessor& fp) override {
239 GrColor color = fp.cast<ReplaceInputFragmentProcessor>().fCo lor; 239 GrColor color = fp.cast<ReplaceInputFragmentProcessor>().fCo lor;
240 if (!fHaveSetColor || color != fPreviousColor) { 240 if (!fHaveSetColor || color != fPreviousColor) {
241 static const float scale = 1.f / 255.f; 241 static const float scale = 1.f / 255.f;
242 float floatColor[4] = { 242 float floatColor[4] = {
(...skipping 126 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/GrPathProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698