Index: src/gpu/effects/GrBicubicEffect.cpp |
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp |
index 027a3c7ab3d8ed41d58a6e5ca9992aec3ce89a14..cb82ea579c7034e05b4b6f52d7fa1db71298165d 100644 |
--- a/src/gpu/effects/GrBicubicEffect.cpp |
+++ b/src/gpu/effects/GrBicubicEffect.cpp |
@@ -23,12 +23,7 @@ class GrGLBicubicEffect : public GrGLFragmentProcessor { |
public: |
GrGLBicubicEffect(const GrProcessor&); |
- virtual void emitCode(GrGLFPBuilder*, |
- const GrFragmentProcessor&, |
- const char* outputColor, |
- const char* inputColor, |
- const TransformedCoordsArray&, |
- const TextureSamplerArray&) override; |
+ virtual void emitCode(EmitArgs&) override; |
void setData(const GrGLProgramDataManager&, const GrProcessor&) override; |
@@ -51,23 +46,18 @@ private: |
GrGLBicubicEffect::GrGLBicubicEffect(const GrProcessor&) { |
} |
-void GrGLBicubicEffect::emitCode(GrGLFPBuilder* builder, |
- const GrFragmentProcessor& effect, |
- const char* outputColor, |
- const char* inputColor, |
- const TransformedCoordsArray& coords, |
- const TextureSamplerArray& samplers) { |
- const GrTextureDomain& domain = effect.cast<GrBicubicEffect>().domain(); |
+void GrGLBicubicEffect::emitCode(EmitArgs& args) { |
+ const GrTextureDomain& domain = args.fFp.cast<GrBicubicEffect>().domain(); |
- fCoefficientsUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
+ fCoefficientsUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
kMat44f_GrSLType, kDefault_GrSLPrecision, |
"Coefficients"); |
- fImageIncrementUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
+ fImageIncrementUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
kVec2f_GrSLType, kDefault_GrSLPrecision, |
"ImageIncrement"); |
- const char* imgInc = builder->getUniformCStr(fImageIncrementUni); |
- const char* coeff = builder->getUniformCStr(fCoefficientsUni); |
+ const char* imgInc = args.fBuilder->getUniformCStr(fImageIncrementUni); |
+ const char* coeff = args.fBuilder->getUniformCStr(fCoefficientsUni); |
SkString cubicBlendName; |
@@ -79,8 +69,8 @@ void GrGLBicubicEffect::emitCode(GrGLFPBuilder* builder, |
GrGLShaderVar("c2", kVec4f_GrSLType), |
GrGLShaderVar("c3", kVec4f_GrSLType), |
}; |
- GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
- SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); |
+ GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder(); |
+ SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0); |
fsBuilder->emitFunction(kVec4f_GrSLType, |
"cubicBlend", |
SK_ARRAY_COUNT(gCubicBlendArgs), |
@@ -104,13 +94,14 @@ void GrGLBicubicEffect::emitCode(GrGLFPBuilder* builder, |
coord.printf("coord + %s * vec2(%d, %d)", imgInc, x - 1, y - 1); |
SkString sampleVar; |
sampleVar.printf("rowColors[%d]", x); |
- fDomain.sampleTexture(fsBuilder, domain, sampleVar.c_str(), coord, samplers[0]); |
+ fDomain.sampleTexture(fsBuilder, domain, sampleVar.c_str(), coord, args.fSamplers[0]); |
} |
fsBuilder->codeAppendf("\tvec4 s%d = %s(%s, f.x, rowColors[0], rowColors[1], rowColors[2], rowColors[3]);\n", y, cubicBlendName.c_str(), coeff); |
} |
SkString bicubicColor; |
bicubicColor.printf("%s(%s, f.y, s0, s1, s2, s3)", cubicBlendName.c_str(), coeff); |
- fsBuilder->codeAppendf("\t%s = %s;\n", outputColor, (GrGLSLExpr4(bicubicColor.c_str()) * GrGLSLExpr4(inputColor)).c_str()); |
+ fsBuilder->codeAppendf("\t%s = %s;\n", args.fOutputColor,(GrGLSLExpr4(bicubicColor.c_str()) * |
+ GrGLSLExpr4(args.fInputColor)).c_str()); |
} |
void GrGLBicubicEffect::setData(const GrGLProgramDataManager& pdman, |