Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: gm/lumafilter.cpp

Issue 1789633002: more shader-->sp conversions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
};
« no previous file with comments | « gm/lcdblendmodes.cpp ('k') | gm/matrixconvolution.cpp » ('j') | gm/pictureshadertile.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698