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

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

Issue 2175563003: Bundle SkShader::asFragmentProcessor arguments in a struct (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix indentation to be less arbitrary Created 4 years, 5 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/SkSweepGradient.h ('k') | src/effects/gradients/SkTwoPointConicalGradient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkSweepGradient.cpp
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
index 9e2b909075746f0b4bbb46fab2fd1de2c3321257..31f481607523e27aeefe76116362fda437c5ee7a 100644
--- a/src/effects/gradients/SkSweepGradient.cpp
+++ b/src/effects/gradients/SkSweepGradient.cpp
@@ -191,10 +191,9 @@ sk_sp<GrFragmentProcessor> GrSweepGradient::TestCreate(GrProcessorTestData* d) {
int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tmIgnored);
sk_sp<SkShader> shader(SkGradientShader::MakeSweep(center.fX, center.fY, colors, stops,
colorCount));
- sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(d->fContext,
- GrTest::TestMatrix(d->fRandom),
- NULL, kNone_SkFilterQuality,
- SkSourceGammaTreatment::kRespect);
+ SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom);
+ sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPArgs(
+ d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, SkSourceGammaTreatment::kRespect));
GrAlwaysAssert(fp);
return fp;
}
@@ -227,27 +226,22 @@ void GrGLSweepGradient::emitCode(EmitArgs& args) {
/////////////////////////////////////////////////////////////////////
-sk_sp<GrFragmentProcessor> SkSweepGradient::asFragmentProcessor(
- GrContext* context,
- const SkMatrix& viewM,
- const SkMatrix* localMatrix,
- SkFilterQuality,
- SkSourceGammaTreatment) const {
+sk_sp<GrFragmentProcessor> SkSweepGradient::asFragmentProcessor(const AsFPArgs& args) const {
SkMatrix matrix;
if (!this->getLocalMatrix().invert(&matrix)) {
return nullptr;
}
- if (localMatrix) {
+ if (args.fLocalMatrix) {
SkMatrix inv;
- if (!localMatrix->invert(&inv)) {
+ if (!args.fLocalMatrix->invert(&inv)) {
return nullptr;
}
matrix.postConcat(inv);
}
matrix.postConcat(fPtsToUnit);
- sk_sp<GrFragmentProcessor> inner(GrSweepGradient::Make(context, *this, matrix));
+ sk_sp<GrFragmentProcessor> inner(GrSweepGradient::Make(args.fContext, *this, matrix));
return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner));
}
« no previous file with comments | « src/effects/gradients/SkSweepGradient.h ('k') | src/effects/gradients/SkTwoPointConicalGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698