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

Unified Diff: gm/tablecolorfilter.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/tablecolorfilter.cpp
diff --git a/gm/tablecolorfilter.cpp b/gm/tablecolorfilter.cpp
index 1053bb25181bc71bbd3af3eb1ecd40f906d0db6e..dcc29f37cf3d8de45cb099f15a8f3aff0259c55a 100644
--- a/gm/tablecolorfilter.cpp
+++ b/gm/tablecolorfilter.cpp
@@ -11,14 +11,14 @@
#include "SkGradientShader.h"
#include "SkTableColorFilter.h"
-static SkShader* make_shader0(int w, int h) {
+static sk_sp<SkShader> make_shader0(int w, int h) {
SkPoint pts[] = { {0, 0}, {SkIntToScalar(w), SkIntToScalar(h)} };
SkColor colors[] = {
SK_ColorBLACK, SK_ColorGREEN, SK_ColorCYAN,
SK_ColorRED, 0, SK_ColorBLUE, SK_ColorWHITE
};
- return SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
- SkShader::kClamp_TileMode);
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ SkShader::kClamp_TileMode);
}
static void make_bm0(SkBitmap* bm) {
int W = 120;
@@ -28,17 +28,17 @@ static void make_bm0(SkBitmap* bm) {
SkCanvas canvas(*bm);
SkPaint paint;
- paint.setShader(make_shader0(W, H))->unref();
+ paint.setShader(make_shader0(W, H));
canvas.drawPaint(paint);
}
-static SkShader* make_shader1(int w, int h) {
+static sk_sp<SkShader> make_shader1(int w, int h) {
SkScalar cx = SkIntToScalar(w)/2;
SkScalar cy = SkIntToScalar(h)/2;
SkColor colors[] = {
SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE,
};
- return SkGradientShader::CreateRadial(SkPoint::Make(cx, cy), cx, colors, nullptr,
- SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode);
+ return SkGradientShader::MakeRadial(SkPoint::Make(cx, cy), cx, colors, nullptr,
+ SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode);
}
static void make_bm1(SkBitmap* bm) {
int W = 120;
@@ -50,7 +50,7 @@ static void make_bm1(SkBitmap* bm) {
SkCanvas canvas(*bm);
SkPaint paint;
- paint.setShader(make_shader1(W, H))->unref();
+ paint.setShader(make_shader1(W, H));
paint.setAntiAlias(true);
canvas.drawCircle(cx, cy, cx, paint);
}
@@ -234,7 +234,7 @@ protected:
}
SkPaint paint;
- paint.setShader(make_shader1(50, 50))->unref();
+ paint.setShader(make_shader1(50, 50));
SkRect r = SkRect::MakeWH(50, 50);
const SkScalar spacer = 10;
« gm/pictureshadertile.cpp ('K') | « gm/surface.cpp ('k') | gm/textbloblooper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698