SkShader::asNewEffect Refactoring
The new signature is:
bool asNewEffect(GrContext* context, const SkPaint& paint, GrColor* grColor, GrEffectRef** grEffect, const SkMatrix* localMatrixOrNull) const;
It will fix the hack for skcolorshader by modifying the GrColor parameter in SkGr::SkPaint2GrPaintShader.
BUG=skia:2646
R=jvanverth@google.com, bsalomon@google.com
Author: dandov@google.com
Review URL: https://codereview.chromium.org/318923005
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index 81e1375..2de8d4d 100644
--- a/src/core/SkPictureShader.cpp
+++ b/src/core/SkPictureShader.cpp
@@ -188,12 +188,20 @@
#endif
#if SK_SUPPORT_GPU
-GrEffectRef* SkPictureShader::asNewEffect(GrContext* context, const SkPaint& paint,
- const SkMatrix* localMatrix) const {
+bool SkPictureShader::asNewEffect(GrContext* context, const SkPaint& paint,
+ const SkMatrix* localMatrix, GrColor* grColor,
+ GrEffectRef** grEffect) const {
SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(context->getMatrix(), localMatrix));
if (!bitmapShader) {
- return NULL;
+ return false;
}
- return bitmapShader->asNewEffect(context, paint, NULL);
+ return bitmapShader->asNewEffect(context, paint, NULL, grColor, grEffect);
+}
+#else
+bool SkPictureShader::asNewEffect(GrContext* context, const SkPaint& paint,
+ const SkMatrix* localMatrix, GrColor* grColor,
+ GrEffectRef** grEffect) const {
+ SkDEBUGFAIL("Should not call in GPU-less build");
+ return false;
}
#endif