partial switch over to sp usage of shaders
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1776973003
Review URL: https://codereview.chromium.org/1776973003
diff --git a/gm/colorfilterimagefilter.cpp b/gm/colorfilterimagefilter.cpp
index daebe0d..4ab91f1 100644
--- a/gm/colorfilterimagefilter.cpp
+++ b/gm/colorfilterimagefilter.cpp
@@ -53,35 +53,36 @@
#include "SkImage.h"
#include "Resources.h"
-static SkShader* sh_make_lineargradient0() {
+static sk_sp<SkShader> sh_make_lineargradient0() {
const SkPoint pts[] = { { 0, 0 }, { 100, 100 } };
const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
- return SkGradientShader::CreateLinear(pts, colors, nullptr, 3, SkShader::kRepeat_TileMode);
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, 3, SkShader::kRepeat_TileMode);
}
-static SkShader* sh_make_lineargradient1() {
+static sk_sp<SkShader> sh_make_lineargradient1() {
const SkPoint pts[] = { { 0, 0 }, { 100, 100 } };
const SkColor colors[] = { SK_ColorRED, 0x0000FF00, SK_ColorBLUE };
- return SkGradientShader::CreateLinear(pts, colors, nullptr, 3, SkShader::kRepeat_TileMode);
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, 3, SkShader::kRepeat_TileMode);
}
-static SkShader* sh_make_image() {
+static sk_sp<SkShader> sh_make_image() {
SkAutoTUnref<SkImage> image(GetResourceAsImage("mandrill_128.png"));
if (!image) {
return nullptr;
}
- return image->newShader(SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);
+ return sk_sp<SkShader>(image->newShader(SkShader::kRepeat_TileMode,
+ SkShader::kRepeat_TileMode));
}
static void sk_gm_get_shaders(SkTDArray<SkShader*>* array) {
- if (SkShader* shader = sh_make_lineargradient0()) {
- *array->append() = shader;
+ if (auto shader = sh_make_lineargradient0()) {
+ *array->append() = shader.release();
}
- if (SkShader* shader = sh_make_lineargradient1()) {
- *array->append() = shader;
+ if (auto shader = sh_make_lineargradient1()) {
+ *array->append() = shader.release();
}
- if (SkShader* shader = sh_make_image()) {
- *array->append() = shader;
+ if (auto shader = sh_make_image()) {
+ *array->append() = shader.release();
}
}