| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |