Index: src/core/SkShader.cpp |
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp |
index 9484db59c18837ac6feaa767cbff03a05cc78613..18fb0d2584a4a19e545a27db58528ae4a32891d9 100644 |
--- a/src/core/SkShader.cpp |
+++ b/src/core/SkShader.cpp |
@@ -208,8 +208,10 @@ SkShader::GradientType SkShader::asAGradient(GradientInfo* info) const { |
return kNone_GradientType; |
} |
-GrEffectRef* SkShader::asNewEffect(GrContext*, const SkPaint&, const SkMatrix*) const { |
- return NULL; |
+bool SkShader::asNewEffect(GrContext* context, const SkPaint& paint, |
+ const SkMatrix* localMatrixOrNull, GrColor* grColor, |
+ GrEffectRef** grEffect) const { |
+ return false; |
} |
SkShader* SkShader::refAsALocalMatrixShader(SkMatrix*) const { |
@@ -341,6 +343,31 @@ SkShader::GradientType SkColorShader::asAGradient(GradientInfo* info) const { |
return kColor_GradientType; |
} |
+#if SK_SUPPORT_GPU |
+ |
+#include "SkGr.h" |
+ |
+bool SkColorShader::asNewEffect(GrContext* context, const SkPaint& paint, |
+ const SkMatrix* localMatrix, GrColor* grColor, |
+ GrEffectRef** grEffect) const { |
+ *grEffect = NULL; |
+ SkColor skColor = fColor; |
+ U8CPU newA = SkMulDiv255Round(SkColorGetA(fColor), paint.getAlpha()); |
+ *grColor = SkColor2GrColor(SkColorSetA(skColor, newA)); |
+ return true; |
+} |
+ |
+#else |
+ |
+bool SkColorShader::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 |
+ |
#ifndef SK_IGNORE_TO_STRING |
void SkColorShader::toString(SkString* str) const { |
str->append("SkColorShader: ("); |