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

Unified Diff: tests/SkColor4fTest.cpp

Issue 1825073002: 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: remove flag 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 | « tests/SerializationTest.cpp ('k') | tools/android/SkAndroidSDKCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SkColor4fTest.cpp
diff --git a/tests/SkColor4fTest.cpp b/tests/SkColor4fTest.cpp
index 94e1b688165e67d3f6f6161d2ab945d6ee57c345..239004aacb35fed695eba2841f247a397244ea44 100644
--- a/tests/SkColor4fTest.cpp
+++ b/tests/SkColor4fTest.cpp
@@ -78,24 +78,22 @@ DEF_TEST(Color4f_premul, reporter) {
//////////////////////////////////////////////////////////////////////////////////////////////////
-static SkColorFilter* make_mode_cf() {
- return SkColorFilter::CreateModeFilter(0xFFBB8855, SkXfermode::kPlus_Mode);
+static sk_sp<SkColorFilter> make_mode_cf() {
+ return SkColorFilter::MakeModeFilter(0xFFBB8855, SkXfermode::kPlus_Mode);
}
-static SkColorFilter* make_mx_cf() {
+static sk_sp<SkColorFilter> make_mx_cf() {
const float mx[] = {
0.5f, 0, 0, 0, 0.1f,
0, 0.5f, 0, 0, 0.2f,
0, 0, 1, 0, -0.1f,
0, 0, 0, 1, 0,
};
- return SkColorMatrixFilter::Create(mx);
+ return SkColorFilter::MakeMatrixFilterRowMajor255(mx);
}
-static SkColorFilter* make_compose_cf() {
- SkAutoTUnref<SkColorFilter> cf0(make_mode_cf());
- SkAutoTUnref<SkColorFilter> cf1(make_mx_cf());
- return SkColorFilter::CreateComposeFilter(cf0, cf1);
+static sk_sp<SkColorFilter> make_compose_cf() {
+ return SkColorFilter::MakeComposeFilter(make_mode_cf(), make_mx_cf());
}
static sk_sp<SkShader> make_color_sh() { return SkShader::MakeColorShader(0xFFBB8855); }
@@ -124,8 +122,7 @@ static sk_sp<SkShader> make_grad_sh() {
}
static sk_sp<SkShader> make_cf_sh() {
- SkAutoTUnref<SkColorFilter> filter(make_mx_cf());
- return make_color_sh()->makeWithColorFilter(filter);
+ return make_color_sh()->makeWithColorFilter(make_mx_cf());
}
static bool compare_spans(const SkPM4f span4f[], const SkPMColor span4b[], int count,
@@ -178,9 +175,9 @@ DEF_TEST(Color4f_shader, reporter) {
DEF_TEST(Color4f_colorfilter, reporter) {
struct {
- SkColorFilter* (*fFact)();
- bool fSupports4f;
- const char* fName;
+ sk_sp<SkColorFilter> (*fFact)();
+ bool fSupports4f;
+ const char* fName;
} recs[] = {
{ make_mode_cf, true, "mode" },
{ make_mx_cf, true, "matrix" },
@@ -200,7 +197,7 @@ DEF_TEST(Color4f_colorfilter, reporter) {
REPORTER_ASSERT(reporter, compare_spans(src4f, src4b, N));
for (const auto& rec : recs) {
- SkAutoTUnref<SkColorFilter> filter(rec.fFact());
+ auto filter(rec.fFact());
SkPMColor dst4b[N];
filter->filterSpan(src4b, N, dst4b);
SkPM4f dst4f[N];
« no previous file with comments | « tests/SerializationTest.cpp ('k') | tools/android/SkAndroidSDKCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698