Index: src/effects/gradients/SkLinearGradient.cpp |
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp |
index 86142fda73e077bb3de2be6360014995b42f60f1..e36a5695623ae11dff652f05f49643040af2ca28 100644 |
--- a/src/effects/gradients/SkLinearGradient.cpp |
+++ b/src/effects/gradients/SkLinearGradient.cpp |
@@ -439,6 +439,7 @@ void SkLinearGradient::LinearGradientContext::shadeSpan16(int x, int y, |
#if SK_SUPPORT_GPU |
+#include "effects/GrExtractAlphaFragmentProcessor.h" |
#include "gl/builders/GrGLProgramBuilder.h" |
#include "SkGr.h" |
@@ -507,7 +508,7 @@ private: |
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrLinearGradient); |
-GrFragmentProcessor* GrLinearGradient::TestCreate(GrProcessorTestData* d) { |
+const GrFragmentProcessor* GrLinearGradient::TestCreate(GrProcessorTestData* d) { |
SkPoint points[] = {{d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}, |
{d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}}; |
@@ -519,12 +520,9 @@ GrFragmentProcessor* GrLinearGradient::TestCreate(GrProcessorTestData* d) { |
SkAutoTUnref<SkShader> shader(SkGradientShader::CreateLinear(points, |
colors, stops, colorCount, |
tm)); |
- SkPaint paint; |
- GrColor paintColor; |
- GrFragmentProcessor* fp; |
- SkAssertResult(shader->asFragmentProcessor(d->fContext, paint, |
- GrTest::TestMatrix(d->fRandom), nullptr, |
- &paintColor, d->fProcDataManager, &fp)); |
+ const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, |
+ GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, d->fProcDataManager); |
+ GrAlwaysAssert(fp); |
return fp; |
} |
@@ -541,40 +539,32 @@ void GrGLLinearGradient::emitCode(EmitArgs& args) { |
///////////////////////////////////////////////////////////////////// |
-bool SkLinearGradient::asFragmentProcessor(GrContext* context, const SkPaint& paint, |
- const SkMatrix& viewm, const SkMatrix* localMatrix, |
- GrColor* paintColor, |
- GrProcessorDataManager* procDataManager, |
- GrFragmentProcessor** fp) const { |
+const GrFragmentProcessor* SkLinearGradient::asFragmentProcessor( |
+ GrContext* context, |
+ const SkMatrix& viewm, |
+ const SkMatrix* localMatrix, |
+ SkFilterQuality, |
+ GrProcessorDataManager* procDataManager) const { |
SkASSERT(context); |
SkMatrix matrix; |
if (!this->getLocalMatrix().invert(&matrix)) { |
- return false; |
+ return nullptr; |
} |
if (localMatrix) { |
SkMatrix inv; |
if (!localMatrix->invert(&inv)) { |
- return false; |
+ return nullptr; |
} |
matrix.postConcat(inv); |
} |
matrix.postConcat(fPtsToUnit); |
- *paintColor = SkColor2GrColorJustAlpha(paint.getColor()); |
- *fp = GrLinearGradient::Create(context, procDataManager, *this, matrix, fTileMode); |
- |
- return true; |
+ SkAutoTUnref<const GrFragmentProcessor> inner( |
+ GrLinearGradient::Create(context, procDataManager, *this, matrix, fTileMode)); |
+ return GrExtractAlphaFragmentProcessor::Create(inner); |
} |
-#else |
- |
-bool SkLinearGradient::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&, |
- const SkMatrix*, GrColor*, GrProcessorDataManager*, |
- GrFragmentProcessor**) const { |
- SkDEBUGFAIL("Should not call in GPU-less build"); |
- return false; |
-} |
#endif |