Index: gm/lumafilter.cpp |
diff --git a/gm/lumafilter.cpp b/gm/lumafilter.cpp |
index 3244b2b055628f7fe3497d17a6fae87ab37d6e0a..adffd008c10bbe571d495d007e3ce827d8c95b61 100644 |
--- a/gm/lumafilter.cpp |
+++ b/gm/lumafilter.cpp |
@@ -26,9 +26,8 @@ static void draw_label(SkCanvas* canvas, const char* label, |
paint); |
} |
-static void draw_scene(SkCanvas* canvas, SkColorFilter* filter, |
- SkXfermode::Mode mode, SkShader* s1, |
- SkShader* s2) { |
+static void draw_scene(SkCanvas* canvas, SkColorFilter* filter, SkXfermode::Mode mode, |
+ const sk_sp<SkShader>& s1, const sk_sp<SkShader>& s2) { |
SkPaint paint; |
paint.setAntiAlias(true); |
SkRect r, c, bounds = SkRect::MakeWH(kSize, kSize); |
@@ -85,16 +84,10 @@ public: |
SkScalar pos[] = { 0.2f, 1.0f }; |
fFilter.reset(SkLumaColorFilter::Create()); |
- fGr1.reset(SkGradientShader::CreateLinear(g1Points, |
- g1Colors, |
- pos, |
- SK_ARRAY_COUNT(g1Colors), |
- SkShader::kClamp_TileMode)); |
- fGr2.reset(SkGradientShader::CreateLinear(g2Points, |
- g2Colors, |
- pos, |
- SK_ARRAY_COUNT(g2Colors), |
- SkShader::kClamp_TileMode)); |
+ fGr1 = SkGradientShader::MakeLinear(g1Points, g1Colors, pos, SK_ARRAY_COUNT(g1Colors), |
+ SkShader::kClamp_TileMode); |
+ fGr2 = SkGradientShader::MakeLinear(g2Points, g2Colors, pos, SK_ARRAY_COUNT(g2Colors), |
+ SkShader::kClamp_TileMode); |
} |
protected: |
@@ -116,8 +109,8 @@ protected: |
SkXfermode::kDstIn_Mode, |
}; |
struct { |
- SkShader* fShader1; |
- SkShader* fShader2; |
+ const sk_sp<SkShader>& fShader1; |
+ const sk_sp<SkShader>& fShader2; |
} shaders[] = { |
{ nullptr, nullptr }, |
{ nullptr, fGr2 }, |
@@ -145,7 +138,7 @@ protected: |
private: |
SkAutoTUnref<SkColorFilter> fFilter; |
- SkAutoTUnref<SkShader> fGr1, fGr2; |
+ sk_sp<SkShader> fGr1, fGr2; |
typedef skiagm::GM INHERITED; |
}; |