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

Unified Diff: src/gpu/effects/GrOvalEffect.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/GrMatrixConvolutionEffect.cpp ('k') | src/gpu/effects/GrRRectEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrOvalEffect.cpp
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp
index e7b52359fc0d01d693fa4cd288b913529f7c8be2..729e8a599c7bb8253813b935bac23082c20f89c5 100644
--- a/src/gpu/effects/GrOvalEffect.cpp
+++ b/src/gpu/effects/GrOvalEffect.cpp
@@ -93,12 +93,7 @@ class GLCircleEffect : public GrGLFragmentProcessor {
public:
GLCircleEffect(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&) override;
static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*);
@@ -116,22 +111,17 @@ GLCircleEffect::GLCircleEffect(const GrProcessor&) {
fPrevRadius = -1.f;
}
-void GLCircleEffect::emitCode(GrGLFPBuilder* builder,
- const GrFragmentProcessor& fp,
- const char* outputColor,
- const char* inputColor,
- const TransformedCoordsArray&,
- const TextureSamplerArray& samplers) {
- const CircleEffect& ce = fp.cast<CircleEffect>();
+void GLCircleEffect::emitCode(EmitArgs& args) {
+ const CircleEffect& ce = args.fFp.cast<CircleEffect>();
const char *circleName;
// The circle uniform is (center.x, center.y, radius + 0.5, 1 / (radius + 0.5)) for regular
// fills and (..., radius - 0.5, 1 / (radius - 0.5)) for inverse fills.
- fCircleUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fCircleUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType, kDefault_GrSLPrecision,
"circle",
&circleName);
- GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
+ GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
const char* fragmentPos = fsBuilder->fragmentPosition();
SkASSERT(kHairlineAA_GrProcessorEdgeType != ce.getEdgeType());
@@ -152,8 +142,8 @@ void GLCircleEffect::emitCode(GrGLFPBuilder* builder,
fsBuilder->codeAppend("\t\td = d > 0.5 ? 1.0 : 0.0;\n");
}
- fsBuilder->codeAppendf("\t\t%s = %s;\n", outputColor,
- (GrGLSLExpr4(inputColor) * GrGLSLExpr1("d")).c_str());
+ fsBuilder->codeAppendf("\t\t%s = %s;\n", args.fOutputColor,
+ (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("d")).c_str());
}
void GLCircleEffect::GenKey(const GrProcessor& processor, const GrGLSLCaps&,
@@ -273,12 +263,7 @@ class GLEllipseEffect : public GrGLFragmentProcessor {
public:
GLEllipseEffect(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&) override;
static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*);
@@ -296,21 +281,16 @@ GLEllipseEffect::GLEllipseEffect(const GrProcessor& effect) {
fPrevRadii.fX = -1.f;
}
-void GLEllipseEffect::emitCode(GrGLFPBuilder* builder,
- const GrFragmentProcessor& fp,
- const char* outputColor,
- const char* inputColor,
- const TransformedCoordsArray&,
- const TextureSamplerArray& samplers) {
- const EllipseEffect& ee = fp.cast<EllipseEffect>();
+void GLEllipseEffect::emitCode(EmitArgs& args) {
+ const EllipseEffect& ee = args.fFp.cast<EllipseEffect>();
const char *ellipseName;
// The ellipse uniform is (center.x, center.y, 1 / rx^2, 1 / ry^2)
- fEllipseUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fEllipseUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType, kDefault_GrSLPrecision,
"ellipse",
&ellipseName);
- GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
+ GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
const char* fragmentPos = fsBuilder->fragmentPosition();
// d is the offset to the ellipse center
@@ -341,8 +321,8 @@ void GLEllipseEffect::emitCode(GrGLFPBuilder* builder,
SkFAIL("Hairline not expected here.");
}
- fsBuilder->codeAppendf("\t\t%s = %s;\n", outputColor,
- (GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
+ fsBuilder->codeAppendf("\t\t%s = %s;\n", args.fOutputColor,
+ (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str());
}
void GLEllipseEffect::GenKey(const GrProcessor& effect, const GrGLSLCaps&,
« no previous file with comments | « src/gpu/effects/GrMatrixConvolutionEffect.cpp ('k') | src/gpu/effects/GrRRectEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698