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

Unified Diff: gm/gradtext.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/gradients_no_texture.cpp ('k') | gm/hairmodes.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gradtext.cpp
diff --git a/gm/gradtext.cpp b/gm/gradtext.cpp
index d66454760bdd13b9a031dd592852931dc66eb44e..acb88d6e52a3676e192eaf37ddbe49c3e2b7a8de 100644
--- a/gm/gradtext.cpp
+++ b/gm/gradtext.cpp
@@ -11,25 +11,28 @@
#include "SkTypeface.h"
// test shader w/ transparency
-static sk_sp<SkShader> make_grad(SkScalar width) {
+static SkShader* make_grad(SkScalar width) {
SkColor colors[] = { SK_ColorRED, 0x0000FF00, SK_ColorBLUE };
SkPoint pts[] = { { 0, 0 }, { width, 0 } };
- return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
- SkShader::kMirror_TileMode);
+ return SkGradientShader::CreateLinear(pts, colors, nullptr,
+ SK_ARRAY_COUNT(colors),
+ SkShader::kMirror_TileMode);
}
// test opaque shader
-static sk_sp<SkShader> make_grad2(SkScalar width) {
+static SkShader* make_grad2(SkScalar width) {
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
SkPoint pts[] = { { 0, 0 }, { width, 0 } };
- return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
- SkShader::kMirror_TileMode);
+ return SkGradientShader::CreateLinear(pts, colors, nullptr,
+ SK_ARRAY_COUNT(colors),
+ SkShader::kMirror_TileMode);
}
-static sk_sp<SkShader> make_chrome_solid() {
+static SkShader* make_chrome_solid() {
SkColor colors[] = { SK_ColorGREEN, SK_ColorGREEN };
SkPoint pts[] = { { 0, 0 }, { 1, 0 } };
- return SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, 2,
+ SkShader::kClamp_TileMode);
}
namespace skiagm {
@@ -53,7 +56,7 @@
canvas->drawRect(r, paint);
// Minimal repro doesn't require AA, LCD, or a nondefault typeface
- paint.setShader(make_chrome_solid());
+ paint.setShader(make_chrome_solid())->unref();
paint.setTextSize(SkIntToScalar(500));
canvas->drawText("I", 1, 0, 100, paint);
@@ -81,7 +84,7 @@
canvas->drawText("Normal Stroke Text", 18, 0, 100, paint);
// Minimal repro doesn't require AA, LCD, or a nondefault typeface
- paint.setShader(make_chrome_solid());
+ paint.setShader(make_chrome_solid())->unref();
paint.setStyle(SkPaint::kFill_Style);
canvas->drawText("Gradient Fill Text", 18, 0, 150, paint);
@@ -137,12 +140,12 @@
canvas->translate(SkIntToScalar(20), paint.getTextSize());
for (int i = 0; i < 2; ++i) {
- paint.setShader(make_grad(SkIntToScalar(80)));
+ paint.setShader(make_grad(SkIntToScalar(80)))->unref();
draw_text3(canvas, paint);
canvas->translate(0, paint.getTextSize() * 2);
- paint.setShader(make_grad2(SkIntToScalar(80)));
+ paint.setShader(make_grad2(SkIntToScalar(80)))->unref();
draw_text3(canvas, paint);
canvas->translate(0, paint.getTextSize() * 2);
« no previous file with comments | « gm/gradients_no_texture.cpp ('k') | gm/hairmodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698