Index: src/effects/gradients/SkSweepGradient.cpp |
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp |
index 3dddbbabed10e168f3c6690722bee787d49f9530..154e3a2f13850d6a54a87c20b9681fd379f97a05 100644 |
--- a/src/effects/gradients/SkSweepGradient.cpp |
+++ b/src/effects/gradients/SkSweepGradient.cpp |
@@ -174,6 +174,7 @@ void SkSweepGradient::SweepGradientContext::shadeSpan16(int x, int y, uint16_t* |
#if SK_SUPPORT_GPU |
#include "GrTBackendEffectFactory.h" |
+#include "SkGr.h" |
class GrGLSweepGradient : public GrGLGradientEffect { |
public: |
@@ -247,7 +248,10 @@ GrEffectRef* GrSweepGradient::TestCreate(SkRandom* random, |
SkAutoTUnref<SkShader> shader(SkGradientShader::CreateSweep(center.fX, center.fY, |
colors, stops, colorCount)); |
SkPaint paint; |
- return shader->asNewEffect(context, paint, NULL); |
+ GrEffectRef* effect; |
+ GrColor grColor; |
+ shader->asNewEffect(context, paint, NULL, &grColor, &effect); |
+ return effect; |
} |
///////////////////////////////////////////////////////////////////// |
@@ -279,28 +283,36 @@ void GrGLSweepGradient::emitCode(GrGLShaderBuilder* builder, |
///////////////////////////////////////////////////////////////////// |
-GrEffectRef* SkSweepGradient::asNewEffect(GrContext* context, const SkPaint&, |
- const SkMatrix* localMatrix) const { |
+bool SkSweepGradient::asNewEffect(GrContext* context, const SkPaint& paint, |
+ const SkMatrix* localMatrix, GrColor* grColor, |
+ GrEffectRef** grEffect) const { |
+ |
SkMatrix matrix; |
if (!this->getLocalMatrix().invert(&matrix)) { |
- return NULL; |
+ return false; |
} |
if (localMatrix) { |
SkMatrix inv; |
if (!localMatrix->invert(&inv)) { |
- return NULL; |
+ return false; |
} |
matrix.postConcat(inv); |
} |
matrix.postConcat(fPtsToUnit); |
- return GrSweepGradient::Create(context, *this, matrix); |
+ |
+ *grEffect = GrSweepGradient::Create(context, *this, matrix); |
+ *grColor = SkColor2GrColorJustAlpha(paint.getColor()); |
+ |
+ return true; |
} |
#else |
-GrEffectRef* SkSweepGradient::asNewEffect(GrContext*, const SkPaint&, const SkMatrix*) const { |
+bool SkSweepGradient::asNewEffect(GrContext* context, const SkPaint& paint, |
+ const SkMatrix* localMatrix, GrColor* grColor, |
+ GrEffectRef** grEffect) const { |
SkDEBUGFAIL("Should not call in GPU-less build"); |
- return NULL; |
+ return false; |
} |
#endif |