aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/shallowgradient.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-03-13 13:01:57 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-13 13:01:57 -0700
commit9283d20afc27571f7a871d1bd1100dd5df584941 (patch)
tree3688fa1847d47e1f2493b040bbe91594f6274cf0 /gm/shallowgradient.cpp
parentce563cdd48ec7ce4e0420dd88760df9be9dba50c (diff)
Revert of more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium.org/1789633002/ )
Reason for revert: seems to have changed pictureshadertile Original issue's description: > more shader-->sp conversions > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1789633002 > > Committed: https://skia.googlesource.com/skia/+/ce563cdd48ec7ce4e0420dd88760df9be9dba50c TBR=fmalita@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1790353002
Diffstat (limited to 'gm/shallowgradient.cpp')
-rw-r--r--gm/shallowgradient.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/gm/shallowgradient.cpp b/gm/shallowgradient.cpp
index 6990ba7c93..764b1a5034 100644
--- a/gm/shallowgradient.cpp
+++ b/gm/shallowgradient.cpp
@@ -8,27 +8,31 @@
#include "gm.h"
#include "SkGradientShader.h"
-typedef sk_sp<SkShader> (*MakeShaderProc)(const SkColor[], int count, const SkSize&);
+typedef SkShader* (*MakeShaderProc)(const SkColor[], int count, const SkSize&);
-static sk_sp<SkShader> shader_linear(const SkColor colors[], int count, const SkSize& size) {
+static SkShader* shader_linear(const SkColor colors[], int count, const SkSize& size) {
SkPoint pts[] = { { 0, 0 }, { size.width(), size.height() } };
- return SkGradientShader::MakeLinear(pts, colors, nullptr, count, SkShader::kClamp_TileMode);
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, count,
+ SkShader::kClamp_TileMode);
}
-static sk_sp<SkShader> shader_radial(const SkColor colors[], int count, const SkSize& size) {
+static SkShader* shader_radial(const SkColor colors[], int count, const SkSize& size) {
SkPoint center = { size.width()/2, size.height()/2 };
- return SkGradientShader::MakeRadial(center, size.width()/2, colors, nullptr, count,
- SkShader::kClamp_TileMode);
+ return SkGradientShader::CreateRadial(center, size.width()/2, colors, nullptr, count,
+ SkShader::kClamp_TileMode);
}
-static sk_sp<SkShader> shader_conical(const SkColor colors[], int count, const SkSize& size) {
+static SkShader* shader_conical(const SkColor colors[], int count, const SkSize& size) {
SkPoint center = { size.width()/2, size.height()/2 };
- return SkGradientShader::MakeTwoPointConical(center, size.width()/64, center, size.width()/2,
- colors, nullptr, count, SkShader::kClamp_TileMode);
+ return SkGradientShader::CreateTwoPointConical(center, size.width()/64,
+ center, size.width()/2,
+ colors, nullptr, count,
+ SkShader::kClamp_TileMode);
}
-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);
+static SkShader* shader_sweep(const SkColor colors[], int count, const SkSize& size) {
+ return SkGradientShader::CreateSweep(size.width()/2, size.height()/2,
+ colors, nullptr, count);
}
class ShallowGradientGM : public skiagm::GM {
@@ -58,7 +62,7 @@ protected:
SkSize size = SkSize::Make(r.width(), r.height());
SkPaint paint;
- paint.setShader(fProc(colors, colorCount, size));
+ paint.setShader(fProc(colors, colorCount, size))->unref();
paint.setDither(fDither);
canvas->drawRect(r, paint);
}