Index: src/effects/SkPerlinNoiseShader.cpp |
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp |
index ef528751dd5a9cbc7ad9f1ae71150219e3eb9a7a..72b7e0280da12bb67d2d05c38b1b902d6ae2675a 100644 |
--- a/src/effects/SkPerlinNoiseShader.cpp |
+++ b/src/effects/SkPerlinNoiseShader.cpp |
@@ -249,18 +249,21 @@ public: |
#endif |
}; |
-SkShader* SkPerlinNoiseShader::CreateFractalNoise(SkScalar baseFrequencyX, SkScalar baseFrequencyY, |
- int numOctaves, SkScalar seed, |
- const SkISize* tileSize) { |
- return new SkPerlinNoiseShader(kFractalNoise_Type, baseFrequencyX, baseFrequencyY, numOctaves, |
- seed, tileSize); |
+sk_sp<SkShader> SkPerlinNoiseShader::MakeFractalNoise(SkScalar baseFrequencyX, |
+ SkScalar baseFrequencyY, |
+ int numOctaves, SkScalar seed, |
+ const SkISize* tileSize) { |
+ return sk_sp<SkShader>(new SkPerlinNoiseShader(kFractalNoise_Type, baseFrequencyX, |
+ baseFrequencyY, numOctaves, |
+ seed, tileSize)); |
} |
-SkShader* SkPerlinNoiseShader::CreateTurbulence(SkScalar baseFrequencyX, SkScalar baseFrequencyY, |
- int numOctaves, SkScalar seed, |
- const SkISize* tileSize) { |
- return new SkPerlinNoiseShader(kTurbulence_Type, baseFrequencyX, baseFrequencyY, numOctaves, |
- seed, tileSize); |
+sk_sp<SkShader> SkPerlinNoiseShader::MakeTurbulence(SkScalar baseFrequencyX, |
+ SkScalar baseFrequencyY, |
+ int numOctaves, SkScalar seed, |
+ const SkISize* tileSize) { |
+ return sk_sp<SkShader>(new SkPerlinNoiseShader(kTurbulence_Type, baseFrequencyX, baseFrequencyY, |
+ numOctaves, seed, tileSize)); |
} |
SkPerlinNoiseShader::SkPerlinNoiseShader(SkPerlinNoiseShader::Type type, |
@@ -295,9 +298,11 @@ SkFlattenable* SkPerlinNoiseShader::CreateProc(SkReadBuffer& buffer) { |
switch (type) { |
case kFractalNoise_Type: |
- return SkPerlinNoiseShader::CreateFractalNoise(freqX, freqY, octaves, seed, &tileSize); |
+ return SkPerlinNoiseShader::MakeFractalNoise(freqX, freqY, octaves, seed, |
+ &tileSize).release(); |
case kTurbulence_Type: |
- return SkPerlinNoiseShader::CreateTubulence(freqX, freqY, octaves, seed, &tileSize); |
+ return SkPerlinNoiseShader::MakeTurbulence(freqX, freqY, octaves, seed, |
+ &tileSize).release(); |
default: |
return nullptr; |
} |
@@ -580,11 +585,11 @@ const GrFragmentProcessor* GrPerlinNoiseEffect::TestCreate(GrProcessorTestData* |
SkScalar baseFrequencyY = d->fRandom->nextRangeScalar(0.01f, |
0.99f); |
- SkAutoTUnref<SkShader> shader(d->fRandom->nextBool() ? |
- SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves, seed, |
- stitchTiles ? &tileSize : nullptr) : |
- SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed, |
- stitchTiles ? &tileSize : nullptr)); |
+ sk_sp<SkShader> shader(d->fRandom->nextBool() ? |
+ SkPerlinNoiseShader::MakeFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves, seed, |
+ stitchTiles ? &tileSize : nullptr) : |
+ SkPerlinNoiseShader::MakeTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed, |
+ stitchTiles ? &tileSize : nullptr)); |
return shader->asFragmentProcessor(d->fContext, |
GrTest::TestMatrix(d->fRandom), nullptr, |