Index: samplecode/PerlinPatch.cpp |
diff --git a/samplecode/PerlinPatch.cpp b/samplecode/PerlinPatch.cpp |
index de4d45164810f14e33e97b20df5f12e0ed063cd4..ad2d6bede0e3683a1c604ccef858e18b58ca9496 100644 |
--- a/samplecode/PerlinPatch.cpp |
+++ b/samplecode/PerlinPatch.cpp |
@@ -60,9 +60,9 @@ const SkScalar TexWidth = 100.0f; |
const SkScalar TexHeight = 100.0f; |
class PerlinPatchView : public SampleView { |
- SkShader* fShader0; |
- SkShader* fShader1; |
- SkShader* fShaderCompose; |
+ sk_sp<SkShader> fShader0; |
+ sk_sp<SkShader> fShader1; |
+ sk_sp<SkShader> fShaderCompose; |
SkScalar fXFreq; |
SkScalar fYFreq; |
SkScalar fSeed; |
@@ -98,7 +98,7 @@ public: |
}; |
const SkPoint points[2] = { SkPoint::Make(0.0f, 0.0f), |
SkPoint::Make(100.0f, 100.0f) }; |
- fShader0 = SkGradientShader::CreateLinear(points, |
+ fShader0 = SkGradientShader::MakeLinear(points, |
colors, |
NULL, |
3, |
@@ -107,9 +107,6 @@ public: |
NULL); |
} |
- virtual ~PerlinPatchView() { |
- SkSafeUnref(fShader0); |
- } |
protected: |
// overrides from SkEventSink |
bool onQuery(SkEvent* evt) override { |
@@ -145,16 +142,14 @@ protected: |
SkAutoTUnref<SkXfermode> xfer(SkXfermode::Create(SkXfermode::kSrc_Mode)); |
SkScalar scaleFreq = 2.0; |
- fShader1 = SkPerlinNoiseShader2::CreateImprovedNoise(fXFreq/scaleFreq, fYFreq/scaleFreq, 4, |
+ fShader1 = SkPerlinNoiseShader2::MakeImprovedNoise(fXFreq/scaleFreq, fYFreq/scaleFreq, 4, |
fSeed); |
- fShaderCompose = SkShader::CreateComposeShader(fShader0, fShader1, nullptr); |
+ fShaderCompose = SkShader::MakeComposeShader(fShader0, fShader1, nullptr); |
paint.setShader(fShaderCompose); |
canvas->drawPatch(fPts, nullptr, texCoords, xfer, paint); |
draw_control_points(canvas, fPts); |
- SkSafeUnref(fShader1); |
- SkSafeUnref(fShaderCompose); |
} |
class PtClick : public Click { |