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

Unified Diff: src/gpu/effects/GrDitherEffect.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/gpu/effects/GrCustomXfermode.cpp ('k') | src/gpu/effects/GrMatrixConvolutionEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrDitherEffect.cpp
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp
index 1638b1fdec2ca119106f4942bca9976527e3f474..e87014094a7e5b4b8c35d64a304a57e58fb2f994 100644
--- a/src/gpu/effects/GrDitherEffect.cpp
+++ b/src/gpu/effects/GrDitherEffect.cpp
@@ -63,12 +63,7 @@ class GLDitherEffect : public GrGLFragmentProcessor {
public:
GLDitherEffect(const GrProcessor&);
- virtual void emitCode(GrGLFPBuilder* builder,
- const GrFragmentProcessor& fp,
- const char* outputColor,
- const char* inputColor,
- const TransformedCoordsArray&,
- const TextureSamplerArray&) override;
+ virtual void emitCode(EmitArgs& args) override;
private:
typedef GrGLFragmentProcessor INHERITED;
@@ -77,13 +72,8 @@ private:
GLDitherEffect::GLDitherEffect(const GrProcessor&) {
}
-void GLDitherEffect::emitCode(GrGLFPBuilder* builder,
- const GrFragmentProcessor& fp,
- const char* outputColor,
- const char* inputColor,
- const TransformedCoordsArray&,
- const TextureSamplerArray& samplers) {
- GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
+void GLDitherEffect::emitCode(EmitArgs& args) {
+ GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
// Generate a random number based on the fragment position. For this
// random number generator, we use the "GLSL rand" function
// that seems to be floating around on the internet. It works under
@@ -97,7 +87,7 @@ void GLDitherEffect::emitCode(GrGLFPBuilder* builder,
"fract(sin(dot(%s.xy ,vec2(12.9898,78.233))) * 43758.5453);\n",
fsBuilder->fragmentPosition());
fsBuilder->codeAppendf("\t\t%s = (1.0/255.0) * vec4(r, r, r, r) + %s;\n",
- outputColor, GrGLSLExpr4(inputColor).c_str());
+ args.fOutputColor, GrGLSLExpr4(args.fInputColor).c_str());
}
//////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/gpu/effects/GrCustomXfermode.cpp ('k') | src/gpu/effects/GrMatrixConvolutionEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698