| Index: src/effects/gradients/SkSweepGradient.cpp
|
| diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
|
| index ae88c8a311d27e91c7f29c8081e23d056f6e29c9..c6699e87e0fabe0877c46013da16a8339879e0e7 100644
|
| --- a/src/effects/gradients/SkSweepGradient.cpp
|
| +++ b/src/effects/gradients/SkSweepGradient.cpp
|
| @@ -167,7 +167,6 @@
|
| #if SK_SUPPORT_GPU
|
|
|
| #include "SkGr.h"
|
| -#include "effects/GrExtractAlphaFragmentProcessor.h"
|
| #include "gl/builders/GrGLProgramBuilder.h"
|
|
|
| class GrGLSweepGradient : public GrGLGradientEffect {
|
| @@ -227,7 +226,7 @@
|
|
|
| GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSweepGradient);
|
|
|
| -const GrFragmentProcessor* GrSweepGradient::TestCreate(GrProcessorTestData* d) {
|
| +GrFragmentProcessor* GrSweepGradient::TestCreate(GrProcessorTestData* d) {
|
| SkPoint center = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()};
|
|
|
| SkColor colors[kMaxRandomGradientColors];
|
| @@ -237,11 +236,12 @@
|
| int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tmIgnored);
|
| SkAutoTUnref<SkShader> shader(SkGradientShader::CreateSweep(center.fX, center.fY,
|
| colors, stops, colorCount));
|
| - const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
| - GrTest::TestMatrix(d->fRandom),
|
| - NULL, kNone_SkFilterQuality,
|
| - d->fProcDataManager);
|
| - GrAlwaysAssert(fp);
|
| + SkPaint paint;
|
| + GrFragmentProcessor* fp;
|
| + GrColor paintColor;
|
| + SkAssertResult(shader->asFragmentProcessor(d->fContext, paint,
|
| + GrTest::TestMatrix(d->fRandom), nullptr,
|
| + &paintColor, d->fProcDataManager, &fp));
|
| return fp;
|
| }
|
|
|
| @@ -270,26 +270,38 @@
|
|
|
| /////////////////////////////////////////////////////////////////////
|
|
|
| -const GrFragmentProcessor* SkSweepGradient::asFragmentProcessor(GrContext* context,
|
| - const SkMatrix& viewM, const SkMatrix* localMatrix, SkFilterQuality,
|
| - GrProcessorDataManager* procDataManager) const {
|
| +bool SkSweepGradient::asFragmentProcessor(GrContext* context, const SkPaint& paint,
|
| + const SkMatrix& viewM,
|
| + const SkMatrix* localMatrix, GrColor* paintColor,
|
| + GrProcessorDataManager* procDataManager,
|
| + GrFragmentProcessor** effect) const {
|
|
|
| SkMatrix matrix;
|
| if (!this->getLocalMatrix().invert(&matrix)) {
|
| - return nullptr;
|
| + return false;
|
| }
|
| if (localMatrix) {
|
| SkMatrix inv;
|
| if (!localMatrix->invert(&inv)) {
|
| - return nullptr;
|
| + return false;
|
| }
|
| matrix.postConcat(inv);
|
| }
|
| matrix.postConcat(fPtsToUnit);
|
|
|
| - SkAutoTUnref<const GrFragmentProcessor> inner(
|
| - GrSweepGradient::Create(context, procDataManager, *this, matrix));
|
| - return GrExtractAlphaFragmentProcessor::Create(inner);
|
| + *effect = GrSweepGradient::Create(context, procDataManager, *this, matrix);
|
| + *paintColor = SkColor2GrColorJustAlpha(paint.getColor());
|
| +
|
| + return true;
|
| +}
|
| +
|
| +#else
|
| +
|
| +bool SkSweepGradient::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&,
|
| + const SkMatrix*, GrColor*, GrProcessorDataManager*,
|
| + GrFragmentProcessor**) const {
|
| + SkDEBUGFAIL("Should not call in GPU-less build");
|
| + return false;
|
| }
|
|
|
| #endif
|
|
|