Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Unified Diff: gm/shallowgradient.cpp

Issue 1790353002: Revert of more shader-->sp conversions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/shadows.cpp ('k') | gm/skbug_257.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/shallowgradient.cpp
diff --git a/gm/shallowgradient.cpp b/gm/shallowgradient.cpp
index 6990ba7c938da6f38dac23b968d80f8cccc58af8..764b1a50342c710da213046e2cd0c66ea5b1cf15 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 @@
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);
}
« no previous file with comments | « gm/shadows.cpp ('k') | gm/skbug_257.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698