diff options
author | reed <reed@google.com> | 2016-03-13 14:13:58 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-13 14:13:58 -0700 |
commit | 1a9b9640843a64af8d9d90337ec3b3fea663196a (patch) | |
tree | 37dae22b03c887f2f0087309bbac84c983c828c5 /gm/shallowgradient.cpp | |
parent | 9283d20afc27571f7a871d1bd1100dd5df584941 (diff) |
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
Diffstat (limited to 'gm/shallowgradient.cpp')
-rw-r--r-- | gm/shallowgradient.cpp | 28 |
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); } |