Change signature of SkShader::asNewEffect(), implement for SkBitmapProcShader.
Review URL: https://codereview.appspot.com/7086051
git-svn-id: http://skia.googlecode.com/svn/trunk@7153 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index 02a56da..db089f6 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -545,12 +545,8 @@
SkAutoTUnref<SkShader> shader(SkGradientShader::CreateRadial(center, radius,
colors, stops, colorCount,
tm));
- GrEffectStage stage;
- shader->asNewEffect(context, &stage);
- GrAssert(NULL != stage.getEffect());
- // const_cast and ref is a hack! Will remove when asNewEffect returns GrEffect*
- stage.getEffect()->ref();
- return const_cast<GrEffect*>(stage.getEffect());
+ SkPaint paint;
+ return shader->asNewEffect(context, paint);
}
/////////////////////////////////////////////////////////////////////
@@ -573,7 +569,7 @@
/////////////////////////////////////////////////////////////////////
-bool SkRadialGradient::asNewEffect(GrContext* context, GrEffectStage* stage) const {
+GrEffect* SkRadialGradient::asNewEffect(GrContext* context, const SkPaint&) const {
SkASSERT(NULL != context && NULL != stage);
SkMatrix matrix;
@@ -581,15 +577,14 @@
return false;
}
matrix.postConcat(fPtsToUnit);
- stage->setEffect(SkNEW_ARGS(GrRadialGradient, (context, *this, matrix, fTileMode)))->unref();
- return true;
+ return SkNEW_ARGS(GrRadialGradient, (context, *this, matrix, fTileMode));
}
#else
-bool SkRadialGradient::asNewEffect(GrContext*, GrEffectStage*) const {
+GrEffect* SkRadialGradient::asNewEffect(GrContext* context, const SkPaint&) const {
SkDEBUGFAIL("Should not call in GPU-less build");
- return false;
+ return NULL;
}
#endif