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

Unified Diff: tests/SkColor4fTest.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 | « 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 239004aacb35fed695eba2841f247a397244ea44..94e1b688165e67d3f6f6161d2ab945d6ee57c345 100644
--- a/tests/SkColor4fTest.cpp
+++ b/tests/SkColor4fTest.cpp
@@ -78,22 +78,24 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
-static sk_sp<SkColorFilter> make_mode_cf() {
- return SkColorFilter::MakeModeFilter(0xFFBB8855, SkXfermode::kPlus_Mode);
-}
-
-static sk_sp<SkColorFilter> make_mx_cf() {
+static SkColorFilter* make_mode_cf() {
+ return SkColorFilter::CreateModeFilter(0xFFBB8855, SkXfermode::kPlus_Mode);
+}
+
+static 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 SkColorFilter::MakeMatrixFilterRowMajor255(mx);
-}
-
-static sk_sp<SkColorFilter> make_compose_cf() {
- return SkColorFilter::MakeComposeFilter(make_mode_cf(), make_mx_cf());
+ return SkColorMatrixFilter::Create(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<SkShader> make_color_sh() { return SkShader::MakeColorShader(0xFFBB8855); }
@@ -122,7 +124,8 @@
}
static sk_sp<SkShader> make_cf_sh() {
- return make_color_sh()->makeWithColorFilter(make_mx_cf());
+ SkAutoTUnref<SkColorFilter> filter(make_mx_cf());
+ return make_color_sh()->makeWithColorFilter(filter);
}
static bool compare_spans(const SkPM4f span4f[], const SkPMColor span4b[], int count,
@@ -175,9 +178,9 @@
DEF_TEST(Color4f_colorfilter, reporter) {
struct {
- sk_sp<SkColorFilter> (*fFact)();
- bool fSupports4f;
- const char* fName;
+ SkColorFilter* (*fFact)();
+ bool fSupports4f;
+ const char* fName;
} recs[] = {
{ make_mode_cf, true, "mode" },
{ make_mx_cf, true, "matrix" },
@@ -197,7 +200,7 @@
REPORTER_ASSERT(reporter, compare_spans(src4f, src4b, N));
for (const auto& rec : recs) {
- auto filter(rec.fFact());
+ SkAutoTUnref<SkColorFilter> 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