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

Unified Diff: src/effects/gradients/SkSweepGradient.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/gradients/SkRadialGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkSweepGradient.cpp
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
index 8a5de755a00ed0a45a8a8fdb214ddc6682902d2e..c3278b23925fcdb61f82fca01da01e164ae900c2 100644
--- a/src/effects/gradients/SkSweepGradient.cpp
+++ b/src/effects/gradients/SkSweepGradient.cpp
@@ -190,12 +190,7 @@ public:
GrGLSweepGradient(const GrProcessor&) {}
virtual ~GrGLSweepGradient() { }
- virtual void emitCode(GrGLFPBuilder*,
- const GrFragmentProcessor&,
- const char* outputColor,
- const char* inputColor,
- const TransformedCoordsArray&,
- const TextureSamplerArray&) override;
+ virtual void emitCode(EmitArgs&) override;
static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProcessorKeyBuilder* b) {
b->add32(GenBaseGradientKey(processor));
@@ -266,16 +261,12 @@ GrFragmentProcessor* GrSweepGradient::TestCreate(GrProcessorTestData* d) {
/////////////////////////////////////////////////////////////////////
-void GrGLSweepGradient::emitCode(GrGLFPBuilder* builder,
- const GrFragmentProcessor& fp,
- const char* outputColor,
- const char* inputColor,
- const TransformedCoordsArray& coords,
- const TextureSamplerArray& samplers) {
- const GrSweepGradient& ge = fp.cast<GrSweepGradient>();
- this->emitUniforms(builder, ge);
- SkString coords2D = builder->getFragmentShaderBuilder()->ensureFSCoords2D(coords, 0);
- const GrGLContextInfo& ctxInfo = builder->ctxInfo();
+void GrGLSweepGradient::emitCode(EmitArgs& args) {
+ const GrSweepGradient& ge = args.fFp.cast<GrSweepGradient>();
+ this->emitUniforms(args.fBuilder, ge);
+ SkString coords2D = args.fBuilder->getFragmentShaderBuilder()
+ ->ensureFSCoords2D(args.fCoords, 0);
+ const GrGLContextInfo& ctxInfo = args.fBuilder->ctxInfo();
SkString t;
// 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi]
// On Intel GPU there is an issue where it reads the second arguement to atan "- %s.x" as an int
@@ -287,7 +278,8 @@ void GrGLSweepGradient::emitCode(GrGLFPBuilder* builder,
t.printf("atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5",
coords2D.c_str(), coords2D.c_str());
}
- this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers);
+ this->emitColor(args.fBuilder, ge, t.c_str(), args.fOutputColor, args.fInputColor,
+ args.fSamplers);
}
/////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/effects/gradients/SkRadialGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698