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

Unified Diff: src/effects/SkPerlinNoiseShader.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/core/SkShader.cpp ('k') | src/effects/gradients/SkLinearGradient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkPerlinNoiseShader.cpp
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 2268d4e1d5ed31d904eabd656aa8b0059d920585..e7b7fa308a6505e53d04e4c21d765fce5ec0dab8 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -592,9 +592,10 @@ sk_sp<GrFragmentProcessor> GrPerlinNoiseEffect::TestCreate(GrProcessorTestData*
SkPerlinNoiseShader::MakeTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed,
stitchTiles ? &tileSize : nullptr));
- return shader->asFragmentProcessor(d->fContext,
- GrTest::TestMatrix(d->fRandom), nullptr,
- kNone_SkFilterQuality, SkSourceGammaTreatment::kRespect);
+ SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom);
+ return shader->asFragmentProcessor(SkShader::AsFPArgs(d->fContext, &viewMatrix, nullptr,
+ kNone_SkFilterQuality,
+ SkSourceGammaTreatment::kRespect));
}
void GrGLPerlinNoise::emitCode(EmitArgs& args) {
@@ -893,20 +894,15 @@ void GrGLPerlinNoise::onSetData(const GrGLSLProgramDataManager& pdman,
}
/////////////////////////////////////////////////////////////////////
-sk_sp<GrFragmentProcessor> SkPerlinNoiseShader::asFragmentProcessor(
- GrContext* context,
- const SkMatrix& viewM,
- const SkMatrix* externalLocalMatrix,
- SkFilterQuality,
- SkSourceGammaTreatment gammaTreatment) const {
- SkASSERT(context);
+sk_sp<GrFragmentProcessor> SkPerlinNoiseShader::asFragmentProcessor(const AsFPArgs& args) const {
+ SkASSERT(args.fContext);
SkMatrix localMatrix = this->getLocalMatrix();
- if (externalLocalMatrix) {
- localMatrix.preConcat(*externalLocalMatrix);
+ if (args.fLocalMatrix) {
+ localMatrix.preConcat(*args.fLocalMatrix);
}
- SkMatrix matrix = viewM;
+ SkMatrix matrix = *args.fViewMatrix;
matrix.preConcat(localMatrix);
if (0 == fNumOctaves) {
@@ -927,13 +923,13 @@ sk_sp<GrFragmentProcessor> SkPerlinNoiseShader::asFragmentProcessor(
SkPerlinNoiseShader::PaintingData* paintingData =
new PaintingData(fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY, matrix);
SkAutoTUnref<GrTexture> permutationsTexture(
- GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(),
- GrTextureParams::ClampNoFilter(), gammaTreatment));
+ GrRefCachedBitmapTexture(args.fContext, paintingData->getPermutationsBitmap(),
+ GrTextureParams::ClampNoFilter(), args.fGammaTreatment));
SkAutoTUnref<GrTexture> noiseTexture(
- GrRefCachedBitmapTexture(context, paintingData->getNoiseBitmap(),
- GrTextureParams::ClampNoFilter(), gammaTreatment));
+ GrRefCachedBitmapTexture(args.fContext, paintingData->getNoiseBitmap(),
+ GrTextureParams::ClampNoFilter(), args.fGammaTreatment));
- SkMatrix m = viewM;
+ SkMatrix m = *args.fViewMatrix;
m.setTranslateX(-localMatrix.getTranslateX() + SK_Scalar1);
m.setTranslateY(-localMatrix.getTranslateY() + SK_Scalar1);
if ((permutationsTexture) && (noiseTexture)) {
« no previous file with comments | « src/core/SkShader.cpp ('k') | src/effects/gradients/SkLinearGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698