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

Unified Diff: gm/color4f.cpp

Issue 1821103004: Revert of Revert[2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (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/blurroundrect.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 ec9bbcbfba9b3056fd7f4b672a27413091ab15f8..2d5b7d2c1ae09a31e4d1f704916828b4941126db 100644
--- a/gm/color4f.cpp
+++ b/gm/color4f.cpp
@@ -22,43 +22,43 @@
return SkShader::MakeColorShader(0x80FF0000);
}
-static sk_sp<SkColorFilter> make_cf_null() {
+static SkColorFilter* make_cf_null() {
return nullptr;
}
-static sk_sp<SkColorFilter> make_cf0() {
+static SkColorFilter* make_cf0() {
SkColorMatrix cm;
cm.setSaturation(0.75f);
- return SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat);
+ return SkColorMatrixFilter::Create(cm);
}
-static sk_sp<SkColorFilter> make_cf1() {
+static SkColorFilter* make_cf1() {
SkColorMatrix cm;
cm.setSaturation(0.75f);
- auto a(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat));
+ SkAutoTUnref<SkColorFilter> a(SkColorMatrixFilter::Create(cm));
// CreateComposedFilter will try to concat these two matrices, resulting in a single
// filter (which is good for speed). For this test, we want to force a real compose of
// these two, so our inner filter has a scale-up, which disables the optimization of
// combining the two matrices.
cm.setScale(1.1f, 0.9f, 1);
- auto b(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat));
- return SkColorFilter::MakeComposeFilter(a, b);
+ SkAutoTUnref<SkColorFilter> b(SkColorMatrixFilter::Create(cm));
+ return SkColorFilter::CreateComposeFilter(a, b);
}
-static sk_sp<SkColorFilter> make_cf2() {
- return SkColorFilter::MakeModeFilter(0x8044CC88, SkXfermode::kSrcATop_Mode);
+static SkColorFilter* make_cf2() {
+ return SkColorFilter::CreateModeFilter(0x8044CC88, SkXfermode::kSrcATop_Mode);
}
static void draw_into_canvas(SkCanvas* canvas) {
const SkRect r = SkRect::MakeWH(50, 100);
sk_sp<SkShader> (*shaders[])() { make_opaque_color, make_alpha_color };
- sk_sp<SkColorFilter> (*filters[])() { make_cf_null, make_cf0, make_cf1, make_cf2 };
+ SkColorFilter* (*filters[])() { make_cf_null, make_cf0, make_cf1, make_cf2 };
SkPaint paint;
for (auto shProc : shaders) {
paint.setShader(shProc());
for (auto cfProc : filters) {
- paint.setColorFilter(cfProc());
+ SkSafeUnref(paint.setColorFilter(cfProc()));
canvas->drawRect(r, paint);
canvas->translate(60, 0);
}
« no previous file with comments | « gm/blurroundrect.cpp ('k') | gm/colorcube.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698