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

Unified Diff: gm/color4f.cpp

Issue 1776973003: partial switch over to sp usage of shaders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move into lua container 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/clippedbitmapshaders.cpp ('k') | gm/colorcube.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/color4f.cpp
diff --git a/gm/color4f.cpp b/gm/color4f.cpp
index 9e6fcf6060ed07b959b38adc2582fd2921c7d14d..2d5b7d2c1ae09a31e4d1f704916828b4941126db 100644
--- a/gm/color4f.cpp
+++ b/gm/color4f.cpp
@@ -14,12 +14,12 @@
#include "SkColorMatrixFilter.h"
#include "SkGradientShader.h"
-static SkShader* make_opaque_color() {
- return SkShader::CreateColorShader(0xFFFF0000);
+static sk_sp<SkShader> make_opaque_color() {
+ return SkShader::MakeColorShader(0xFFFF0000);
}
-static SkShader* make_alpha_color() {
- return SkShader::CreateColorShader(0x80FF0000);
+static sk_sp<SkShader> make_alpha_color() {
+ return SkShader::MakeColorShader(0x80FF0000);
}
static SkColorFilter* make_cf_null() {
@@ -51,12 +51,12 @@ static SkColorFilter* make_cf2() {
static void draw_into_canvas(SkCanvas* canvas) {
const SkRect r = SkRect::MakeWH(50, 100);
- SkShader* (*shaders[])() { make_opaque_color, make_alpha_color };
+ sk_sp<SkShader> (*shaders[])() { make_opaque_color, make_alpha_color };
SkColorFilter* (*filters[])() { make_cf_null, make_cf0, make_cf1, make_cf2 };
SkPaint paint;
for (auto shProc : shaders) {
- paint.setShader(shProc())->unref();
+ paint.setShader(shProc());
for (auto cfProc : filters) {
SkSafeUnref(paint.setColorFilter(cfProc()));
canvas->drawRect(r, paint);
« no previous file with comments | « gm/clippedbitmapshaders.cpp ('k') | gm/colorcube.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698