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

Unified Diff: src/effects/SkColorMatrixFilter.cpp

Issue 1251173002: Added GrGLFragmentProcessor::EmitArgs struct for use with emitCode() (Closed) Base URL: https://skia.googlesource.com/skia@composeshader_gpu
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/SkColorFilters.cpp ('k') | src/effects/SkDisplacementMapEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkColorMatrixFilter.cpp
diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp
index 205bcdb49100ddec2be6f946a8d32d794c394069..d0bd1625acdfea2b4e176dd611f49046ad01c3d5 100644
--- a/src/effects/SkColorMatrixFilter.cpp
+++ b/src/effects/SkColorMatrixFilter.cpp
@@ -413,34 +413,31 @@ public:
GLProcessor(const GrProcessor&) {}
- virtual void emitCode(GrGLFPBuilder* builder,
- const GrFragmentProcessor&,
- const char* outputColor,
- const char* inputColor,
- const TransformedCoordsArray&,
- const TextureSamplerArray&) override {
- fMatrixHandle = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ virtual void emitCode(EmitArgs& args) override {
+ fMatrixHandle = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kMat44f_GrSLType, kDefault_GrSLPrecision,
"ColorMatrix");
- fVectorHandle = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fVectorHandle = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType, kDefault_GrSLPrecision,
"ColorMatrixVector");
- if (NULL == inputColor) {
+ if (NULL == args.fInputColor) {
// could optimize this case, but we aren't for now.
- inputColor = "vec4(1)";
+ args.fInputColor = "vec4(1)";
}
- GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
+ GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
// The max() is to guard against 0 / 0 during unpremul when the incoming color is
// transparent black.
- fsBuilder->codeAppendf("\tfloat nonZeroAlpha = max(%s.a, 0.00001);\n", inputColor);
+ fsBuilder->codeAppendf("\tfloat nonZeroAlpha = max(%s.a, 0.00001);\n",
+ args.fInputColor);
fsBuilder->codeAppendf("\t%s = %s * vec4(%s.rgb / nonZeroAlpha, nonZeroAlpha) + %s;\n",
- outputColor,
- builder->getUniformCStr(fMatrixHandle),
- inputColor,
- builder->getUniformCStr(fVectorHandle));
- fsBuilder->codeAppendf("\t%s = clamp(%s, 0.0, 1.0);\n", outputColor, outputColor);
- fsBuilder->codeAppendf("\t%s.rgb *= %s.a;\n", outputColor, outputColor);
+ args.fOutputColor,
+ args.fBuilder->getUniformCStr(fMatrixHandle),
+ args.fInputColor,
+ args.fBuilder->getUniformCStr(fVectorHandle));
+ fsBuilder->codeAppendf("\t%s = clamp(%s, 0.0, 1.0);\n",
+ args.fOutputColor, args.fOutputColor);
+ fsBuilder->codeAppendf("\t%s.rgb *= %s.a;\n", args.fOutputColor, args.fOutputColor);
}
virtual void setData(const GrGLProgramDataManager& uniManager,
« no previous file with comments | « src/effects/SkColorFilters.cpp ('k') | src/effects/SkDisplacementMapEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698