Index: gm/perlinnoise.cpp |
diff --git a/gm/perlinnoise.cpp b/gm/perlinnoise.cpp |
index 92f0f963c3ee70bcb4b0efe53b713237cd10974d..b3ece9dcb6a1a998f304740933a1aa7d6835b493 100644 |
--- a/gm/perlinnoise.cpp |
+++ b/gm/perlinnoise.cpp |
@@ -37,13 +37,13 @@ protected: |
float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, |
bool stitchTiles) { |
SkISize tileSize = SkISize::Make(fSize.width() / 2, fSize.height() / 2); |
- SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ? |
- SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves, |
- seed, stitchTiles ? &tileSize : nullptr) : |
- SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, |
+ sk_sp<SkShader> shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ? |
+ SkPerlinNoiseShader::MakeFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves, |
+ seed, stitchTiles ? &tileSize : nullptr) : |
+ SkPerlinNoiseShader::MakeTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, |
seed, stitchTiles ? &tileSize : nullptr); |
SkPaint paint; |
- paint.setShader(shader)->unref(); |
+ paint.setShader(std::move(shader)); |
if (stitchTiles) { |
drawRect(canvas, x, y, paint, tileSize); |
x += tileSize.width(); |
@@ -110,12 +110,12 @@ protected: |
void install(SkPaint* paint, SkPerlinNoiseShader::Type type, |
float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, |
bool stitchTiles) { |
- SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ? |
- SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves, |
- seed, stitchTiles ? &fSize : nullptr) : |
- SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, |
- seed, stitchTiles ? &fSize : nullptr); |
- paint->setShader(shader)->unref(); |
+ sk_sp<SkShader> shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ? |
+ SkPerlinNoiseShader::MakeFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves, |
+ seed, stitchTiles ? &fSize : nullptr) : |
+ SkPerlinNoiseShader::MakeTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, |
+ seed, stitchTiles ? &fSize : nullptr); |
+ paint->setShader(std::move(shader)); |
} |
virtual void onDraw(SkCanvas* canvas) { |