Index: src/core/SkShader.cpp |
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp |
index b3edf47dfd3c921c3abbb09bf8a533b54b7fa909..51a8017b5e7249c2ed91b55a75acc00d3575af9b 100644 |
--- a/src/core/SkShader.cpp |
+++ b/src/core/SkShader.cpp |
@@ -214,10 +214,10 @@ |
return kNone_GradientType; |
} |
-const GrFragmentProcessor* SkShader::asFragmentProcessor(GrContext*, const SkMatrix&, |
- const SkMatrix*, SkFilterQuality, |
- GrProcessorDataManager*) const { |
- return nullptr; |
+bool SkShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&, const SkMatrix*, |
+ GrColor*, GrProcessorDataManager*, |
+ GrFragmentProcessor**) const { |
+ return false; |
} |
SkShader* SkShader::refAsALocalMatrixShader(SkMatrix*) const { |
@@ -335,12 +335,24 @@ |
#if SK_SUPPORT_GPU |
#include "SkGr.h" |
-#include "effects/GrConstColorProcessor.h" |
-const GrFragmentProcessor* SkColorShader::asFragmentProcessor(GrContext*, const SkMatrix&, |
- const SkMatrix*, SkFilterQuality, |
- GrProcessorDataManager*) const { |
- GrColor color = SkColor2GrColor(fColor); |
- return GrConstColorProcessor::Create(color, GrConstColorProcessor::kModulateA_InputMode); |
+ |
+bool SkColorShader::asFragmentProcessor(GrContext*, const SkPaint& paint, const SkMatrix&, |
+ const SkMatrix*, GrColor* paintColor, |
+ GrProcessorDataManager*, GrFragmentProcessor** fp) const { |
+ *fp = nullptr; |
+ SkColor skColor = fColor; |
+ U8CPU newA = SkMulDiv255Round(SkColorGetA(fColor), paint.getAlpha()); |
+ *paintColor = SkColor2GrColor(SkColorSetA(skColor, newA)); |
+ return true; |
+} |
+ |
+#else |
+ |
+bool SkColorShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&, |
+ const SkMatrix*, GrColor*, GrProcessorDataManager*, |
+ GrFragmentProcessor**) const { |
+ SkDEBUGFAIL("Should not call in GPU-less build"); |
+ return false; |
} |
#endif |