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

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

Issue 1313573005: Revert of Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor* (Closed) Base URL: https://skia.googlesource.com/skia.git@things
Patch Set: 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 df27ebcb17ef9e9eec64d38fbcd30b93527ffe60..86142fda73e077bb3de2be6360014995b42f60f1 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -439,7 +439,6 @@
#if SK_SUPPORT_GPU
-#include "effects/GrExtractAlphaFragmentProcessor.h"
#include "gl/builders/GrGLProgramBuilder.h"
#include "SkGr.h"
@@ -508,7 +507,7 @@
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrLinearGradient);
-const GrFragmentProcessor* GrLinearGradient::TestCreate(GrProcessorTestData* d) {
+GrFragmentProcessor* GrLinearGradient::TestCreate(GrProcessorTestData* d) {
SkPoint points[] = {{d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()},
{d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}};
@@ -520,9 +519,12 @@
SkAutoTUnref<SkShader> shader(SkGradientShader::CreateLinear(points,
colors, stops, colorCount,
tm));
- const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
- GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, d->fProcDataManager);
- GrAlwaysAssert(fp);
+ SkPaint paint;
+ GrColor paintColor;
+ GrFragmentProcessor* fp;
+ SkAssertResult(shader->asFragmentProcessor(d->fContext, paint,
+ GrTest::TestMatrix(d->fRandom), nullptr,
+ &paintColor, d->fProcDataManager, &fp));
return fp;
}
@@ -539,29 +541,40 @@
/////////////////////////////////////////////////////////////////////
-const GrFragmentProcessor* SkLinearGradient::asFragmentProcessor(
- GrContext* context, const SkMatrix& viewm, const SkMatrix* localMatrix, SkFilterQuality,
- GrProcessorDataManager* procDataManager) const {
+bool SkLinearGradient::asFragmentProcessor(GrContext* context, const SkPaint& paint,
+ const SkMatrix& viewm, const SkMatrix* localMatrix,
+ GrColor* paintColor,
+ GrProcessorDataManager* procDataManager,
+ GrFragmentProcessor** fp) const {
SkASSERT(context);
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(
- GrLinearGradient::Create(context, procDataManager, *this, matrix, fTileMode));
- return GrExtractAlphaFragmentProcessor::Create(inner);
-}
-
+ *paintColor = SkColor2GrColorJustAlpha(paint.getColor());
+ *fp = GrLinearGradient::Create(context, procDataManager, *this, matrix, fTileMode);
+
+ return true;
+}
+
+#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