Index: samplecode/SamplePatch.cpp |
diff --git a/samplecode/SamplePatch.cpp b/samplecode/SamplePatch.cpp |
index 5347b0182a706f52895c8c760a68b0d1c254e2f3..c9ecb709900da8fa6293d947843763264099420f 100644 |
--- a/samplecode/SamplePatch.cpp |
+++ b/samplecode/SamplePatch.cpp |
@@ -28,21 +28,21 @@ |
#include "SkGeometry.h" // private include :( |
-static SkShader* make_shader0(SkIPoint* size) { |
+static sk_sp<SkShader> make_shader0(SkIPoint* size) { |
SkBitmap bm; |
// SkImageDecoder::DecodeFile("/skimages/progressivejpg.jpg", &bm); |
SkImageDecoder::DecodeFile("/skimages/logo.png", &bm); |
size->set(bm.width(), bm.height()); |
- return SkShader::CreateBitmapShader(bm, SkShader::kClamp_TileMode, |
- SkShader::kClamp_TileMode); |
+ return SkShader::MakeBitmapShader(bm, SkShader::kClamp_TileMode, |
+ SkShader::kClamp_TileMode); |
} |
-static SkShader* make_shader1(const SkIPoint& size) { |
+static sk_sp<SkShader> make_shader1(const SkIPoint& size) { |
SkPoint pts[] = { { 0, 0, }, |
{ SkIntToScalar(size.fX), SkIntToScalar(size.fY) } }; |
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED }; |
- return SkGradientShader::CreateLinear(pts, colors, nullptr, |
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, |
SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode); |
} |
@@ -211,8 +211,8 @@ const SkScalar DY = 0; |
class PatchView : public SampleView { |
SkScalar fAngle; |
- SkShader* fShader0; |
- SkShader* fShader1; |
+ sk_sp<SkShader> fShader0; |
+ sk_sp<SkShader> fShader1; |
SkIPoint fSize0, fSize1; |
SkPoint fPts[12]; |
@@ -243,11 +243,6 @@ public: |
this->setBGColor(SK_ColorGRAY); |
} |
- virtual ~PatchView() { |
- SkSafeUnref(fShader0); |
- SkSafeUnref(fShader1); |
- } |
- |
protected: |
// overrides from SkEventSink |
bool onQuery(SkEvent* evt) override { |