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

Unified Diff: tests/ColorFilterTest.cpp

Issue 1820303002: Revert of switch colorfilters to sk_sp (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 | « src/utils/SkRGBAToYUV.cpp ('k') | tests/ColorMatrixTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ColorFilterTest.cpp
diff --git a/tests/ColorFilterTest.cpp b/tests/ColorFilterTest.cpp
index 822fb0bd70f5a34eb8b3ca0516b79206269bf2de..ee8f12b2fbc9387658a719f0ffc6717d8a4cce0e 100644
--- a/tests/ColorFilterTest.cpp
+++ b/tests/ColorFilterTest.cpp
@@ -15,7 +15,7 @@
#include "SkXfermode.h"
#include "Test.h"
-static sk_sp<SkColorFilter> reincarnate_colorfilter(SkFlattenable* obj) {
+static SkColorFilter* reincarnate_colorfilter(SkFlattenable* obj) {
SkWriteBuffer wb;
wb.writeFlattenable(obj);
@@ -30,18 +30,18 @@
///////////////////////////////////////////////////////////////////////////////
-static sk_sp<SkColorFilter> make_filter() {
+static SkColorFilter* make_filter() {
// pick a filter that cannot compose with itself via newComposed()
- return SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kColorBurn_Mode);
+ return SkColorFilter::CreateModeFilter(SK_ColorRED, SkXfermode::kColorBurn_Mode);
}
static void test_composecolorfilter_limit(skiatest::Reporter* reporter) {
// Test that CreateComposeFilter() has some finite limit (i.e. that the factory can return null)
const int way_too_many = 100;
- auto parent(make_filter());
+ SkAutoTUnref<SkColorFilter> parent(make_filter());
for (int i = 2; i < way_too_many; ++i) {
- auto filter(make_filter());
- parent = SkColorFilter::MakeComposeFilter(parent, filter);
+ SkAutoTUnref<SkColorFilter> filter(make_filter());
+ parent.reset(SkColorFilter::CreateComposeFilter(parent, filter));
if (nullptr == parent) {
REPORTER_ASSERT(reporter, i > 2); // we need to have succeeded at least once!
return;
@@ -62,13 +62,15 @@
// special case that would return nullptr (if color's alpha is 0 or 0xFF)
color = SkColorSetA(color, 0x7F);
- auto cf = SkColorFilter::MakeModeFilter(color, (SkXfermode::Mode)mode);
+ SkColorFilter* cf = SkColorFilter::CreateModeFilter(color,
+ (SkXfermode::Mode)mode);
// allow for no filter if we're in Dst mode (its a no op)
if (SkXfermode::kDst_Mode == mode && nullptr == cf) {
continue;
}
+ SkAutoUnref aur(cf);
REPORTER_ASSERT(reporter, cf);
SkColor c = ~color;
@@ -96,7 +98,8 @@
REPORTER_ASSERT(reporter, m == expectedMode);
{
- auto cf2 = reincarnate_colorfilter(cf.get());
+ SkColorFilter* cf2 = reincarnate_colorfilter(cf);
+ SkAutoUnref aur2(cf2);
REPORTER_ASSERT(reporter, cf2);
SkColor c2 = ~color;
@@ -114,7 +117,7 @@
DEF_TEST(LumaColorFilter, reporter) {
SkPMColor in, out;
- auto lf(SkLumaColorFilter::Make());
+ SkAutoTUnref<SkColorFilter> lf(SkLumaColorFilter::Create());
// Applying luma to white produces black with the same transparency.
for (unsigned i = 0; i < 256; ++i) {
@@ -180,31 +183,31 @@
matrix[18] = 1.f;
}
-static sk_sp<SkColorFilter> make_cf0() {
+static SkColorFilter* make_cf0() {
SkScalar matrix[20];
get_brightness_matrix(0.5f, matrix);
- return SkColorFilter::MakeMatrixFilterRowMajor255(matrix);
-}
-static sk_sp<SkColorFilter> make_cf1() {
+ return SkColorMatrixFilter::Create(matrix);
+}
+static SkColorFilter* make_cf1() {
SkScalar matrix[20];
get_grayscale_matrix(1, matrix);
- return SkColorFilter::MakeMatrixFilterRowMajor255(matrix);
-}
-static sk_sp<SkColorFilter> make_cf2() {
+ return SkColorMatrixFilter::Create(matrix);
+}
+static SkColorFilter* make_cf2() {
SkColorMatrix m0, m1;
get_brightness_matrix(0.5f, m0.fMat);
get_grayscale_matrix(1, m1.fMat);
m0.preConcat(m1);
- return SkColorFilter::MakeMatrixFilterRowMajor255(m0.fMat);
-}
-static sk_sp<SkColorFilter> make_cf3() {
+ return SkColorMatrixFilter::Create(m0);
+}
+static SkColorFilter* make_cf3() {
SkColorMatrix m0, m1;
get_brightness_matrix(0.5f, m0.fMat);
get_grayscale_matrix(1, m1.fMat);
m0.postConcat(m1);
- return SkColorFilter::MakeMatrixFilterRowMajor255(m0.fMat);
-}
-typedef sk_sp<SkColorFilter> (*CFProc)();
+ return SkColorMatrixFilter::Create(m0);
+}
+typedef SkColorFilter* (*CFProc)();
// Test that a colormatrix that "should" preserve opaquness actually does.
DEF_TEST(ColorMatrixFilter, reporter) {
@@ -213,7 +216,7 @@
};
for (size_t i = 0; i < SK_ARRAY_COUNT(procs); ++i) {
- auto cf(procs[i]());
+ SkAutoTUnref<SkColorFilter> cf(procs[i]());
// generate all possible r,g,b triples
for (int r = 0; r < 256; ++r) {
« no previous file with comments | « src/utils/SkRGBAToYUV.cpp ('k') | tests/ColorMatrixTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698