aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/shallowgradient.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-03-13 12:32:36 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-13 12:32:36 -0700
commitce563cdd48ec7ce4e0420dd88760df9be9dba50c (patch)
tree8d247c8564cf2fa112f7d34d2c139ed6317fc9a8 /gm/shallowgradient.cpp
parent94ad73ac1648fec5e73e29839d461ecb6366a888 (diff)
more shader-->sp conversions
Diffstat (limited to 'gm/shallowgradient.cpp')
-rw-r--r--gm/shallowgradient.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/gm/shallowgradient.cpp b/gm/shallowgradient.cpp
index 764b1a5034..6990ba7c93 100644
--- a/gm/shallowgradient.cpp
+++ b/gm/shallowgradient.cpp
@@ -8,31 +8,27 @@
#include "gm.h"
#include "SkGradientShader.h"
-typedef SkShader* (*MakeShaderProc)(const SkColor[], int count, const SkSize&);
+typedef sk_sp<SkShader> (*MakeShaderProc)(const SkColor[], int count, const SkSize&);
-static SkShader* shader_linear(const SkColor colors[], int count, const SkSize& size) {
+static sk_sp<SkShader> shader_linear(const SkColor colors[], int count, const SkSize& size) {
SkPoint pts[] = { { 0, 0 }, { size.width(), size.height() } };
- return SkGradientShader::CreateLinear(pts, colors, nullptr, count,
- SkShader::kClamp_TileMode);
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, count, SkShader::kClamp_TileMode);
}
-static SkShader* shader_radial(const SkColor colors[], int count, const SkSize& size) {
+static sk_sp<SkShader> shader_radial(const SkColor colors[], int count, const SkSize& size) {
SkPoint center = { size.width()/2, size.height()/2 };
- return SkGradientShader::CreateRadial(center, size.width()/2, colors, nullptr, count,
- SkShader::kClamp_TileMode);
+ return SkGradientShader::MakeRadial(center, size.width()/2, colors, nullptr, count,
+ SkShader::kClamp_TileMode);
}
-static SkShader* shader_conical(const SkColor colors[], int count, const SkSize& size) {
+static sk_sp<SkShader> shader_conical(const SkColor colors[], int count, const SkSize& size) {
SkPoint center = { size.width()/2, size.height()/2 };
- return SkGradientShader::CreateTwoPointConical(center, size.width()/64,
- center, size.width()/2,
- colors, nullptr, count,
- SkShader::kClamp_TileMode);
+ return SkGradientShader::MakeTwoPointConical(center, size.width()/64, center, size.width()/2,
+ colors, nullptr, count, SkShader::kClamp_TileMode);
}
-static SkShader* shader_sweep(const SkColor colors[], int count, const SkSize& size) {
- return SkGradientShader::CreateSweep(size.width()/2, size.height()/2,
- colors, nullptr, count);
+static sk_sp<SkShader> shader_sweep(const SkColor colors[], int count, const SkSize& size) {
+ return SkGradientShader::MakeSweep(size.width()/2, size.height()/2, colors, nullptr, count);
}
class ShallowGradientGM : public skiagm::GM {
@@ -62,7 +58,7 @@ protected:
SkSize size = SkSize::Make(r.width(), r.height());
SkPaint paint;
- paint.setShader(fProc(colors, colorCount, size))->unref();
+ paint.setShader(fProc(colors, colorCount, size));
paint.setDither(fDither);
canvas->drawRect(r, paint);
}