diff options
Diffstat (limited to 'src/effects/gradients/SkSweepGradient.cpp')
-rw-r--r-- | src/effects/gradients/SkSweepGradient.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp index a783e3757c..589cf4ad14 100644 --- a/src/effects/gradients/SkSweepGradient.cpp +++ b/src/effects/gradients/SkSweepGradient.cpp @@ -399,7 +399,9 @@ public: const char* inputColor, const TextureSamplerArray&) SK_OVERRIDE; - static EffectKey GenKey(const GrEffectStage&, const GrGLCaps& caps) { return 0; } + static EffectKey GenKey(const GrEffectStage& stage, const GrGLCaps&) { + return GenMatrixKey(stage); + } private: @@ -413,8 +415,9 @@ class GrSweepGradient : public GrGradientEffect { public: GrSweepGradient(GrContext* ctx, - const SkSweepGradient& shader) - : INHERITED(ctx, shader, SkShader::kClamp_TileMode) { } + const SkSweepGradient& shader, + const SkMatrix& matrix) + : INHERITED(ctx, shader, matrix, SkShader::kClamp_TileMode) { } virtual ~GrSweepGradient() { } static const char* Name() { return "Sweep Gradient"; } @@ -457,16 +460,17 @@ GrEffect* GrSweepGradient::TestCreate(SkRandom* random, ///////////////////////////////////////////////////////////////////// void GrGLSweepGradient::emitCode(GrGLShaderBuilder* builder, - const GrEffectStage&, - EffectKey, + const GrEffectStage& stage, + EffectKey key, const char* vertexCoords, const char* outputColor, const char* inputColor, const TextureSamplerArray& samplers) { this->emitYCoordUniform(builder); + const char* coords; + this->setupMatrix(builder, key, vertexCoords, &coords); SkString t; - t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", - builder->defaultTexCoordsName(), builder->defaultTexCoordsName()); + t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", coords, coords); this->emitColorLookup(builder, t.c_str(), outputColor, inputColor, samplers[0]); } @@ -478,7 +482,7 @@ bool SkSweepGradient::asNewEffect(GrContext* context, GrEffectStage* stage) cons return false; } matrix.postConcat(fPtsToUnit); - stage->setEffect(SkNEW_ARGS(GrSweepGradient, (context, *this)), matrix)->unref(); + stage->setEffect(SkNEW_ARGS(GrSweepGradient, (context, *this, matrix)))->unref(); return true; } |