Reland of "more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium.org/1789633002/ )"
This reverts commit 9283d20afc27571f7a871d1bd1100dd5df584941.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1793303002
Review URL: https://codereview.chromium.org/1793303002
diff --git a/gm/surface.cpp b/gm/surface.cpp
index c3eaf9e..6874b5b 100644
--- a/gm/surface.cpp
+++ b/gm/surface.cpp
@@ -13,12 +13,12 @@
#define W 200
#define H 100
-static SkShader* make_shader() {
+static sk_sp<SkShader> make_shader() {
int a = 0x99;
int b = 0xBB;
SkPoint pts[] = { { 0, 0 }, { W, H } };
SkColor colors[] = { SkColorSetRGB(a, a, a), SkColorSetRGB(b, b, b) };
- return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
}
static SkSurface* make_surface(GrContext* ctx, const SkImageInfo& info, SkPixelGeometry geo,
@@ -46,7 +46,7 @@
paint.setLCDRenderText(true);
paint.setDither(true);
- paint.setShader(make_shader())->unref();
+ paint.setShader(make_shader());
canvas->drawRect(SkRect::MakeWH(W, H), paint);
paint.setShader(nullptr);