Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Unified Diff: src/effects/gradients/SkLinearGradient.cpp

Issue 1316513002: Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor* (Closed) Base URL: https://skia.googlesource.com/skia.git@things
Patch Set: Address comments, fix roll(?) Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/gradients/SkLinearGradient.h ('k') | src/effects/gradients/SkRadialGradient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/effects/gradients/SkLinearGradient.h ('k') | src/effects/gradients/SkRadialGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698