aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-03-22 08:10:17 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-22 08:10:17 -0700
commit4c9776b046dd5e9e46e2d1ce35154855c8fcb381 (patch)
tree3cdcc394a99b0483921eb86a8f5cc118f20d6433 /tests
parent1eb81db650d31f50be67b12d60c4f9e7dd08432f (diff)
Revert[2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.org/1822623002/ )"
Fixed legacy withColorFilter to call new(er) make method This reverts commit 1eb81db650d31f50be67b12d60c4f9e7dd08432f. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1825073002 TBR= Review URL: https://codereview.chromium.org/1825073002
Diffstat (limited to 'tests')
-rw-r--r--tests/ColorFilterTest.cpp41
-rw-r--r--tests/ColorMatrixTest.cpp6
-rw-r--r--tests/GpuColorFilterTest.cpp3
-rw-r--r--tests/ImageFilterTest.cpp41
-rw-r--r--tests/PaintTest.cpp4
-rw-r--r--tests/PictureTest.cpp2
-rw-r--r--tests/RecordOptsTest.cpp2
-rw-r--r--tests/SerializationTest.cpp2
-rw-r--r--tests/SkColor4fTest.cpp25
9 files changed, 57 insertions, 69 deletions
diff --git a/tests/ColorFilterTest.cpp b/tests/ColorFilterTest.cpp
index ee8f12b2fb..822fb0bd70 100644
--- a/tests/ColorFilterTest.cpp
+++ b/tests/ColorFilterTest.cpp
@@ -15,7 +15,7 @@
#include "SkXfermode.h"
#include "Test.h"
-static SkColorFilter* reincarnate_colorfilter(SkFlattenable* obj) {
+static sk_sp<SkColorFilter> reincarnate_colorfilter(SkFlattenable* obj) {
SkWriteBuffer wb;
wb.writeFlattenable(obj);
@@ -30,18 +30,18 @@ static SkColorFilter* reincarnate_colorfilter(SkFlattenable* obj) {
///////////////////////////////////////////////////////////////////////////////
-static SkColorFilter* make_filter() {
+static sk_sp<SkColorFilter> make_filter() {
// pick a filter that cannot compose with itself via newComposed()
- return SkColorFilter::CreateModeFilter(SK_ColorRED, SkXfermode::kColorBurn_Mode);
+ return SkColorFilter::MakeModeFilter(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;
- SkAutoTUnref<SkColorFilter> parent(make_filter());
+ auto parent(make_filter());
for (int i = 2; i < way_too_many; ++i) {
- SkAutoTUnref<SkColorFilter> filter(make_filter());
- parent.reset(SkColorFilter::CreateComposeFilter(parent, filter));
+ auto filter(make_filter());
+ parent = SkColorFilter::MakeComposeFilter(parent, filter);
if (nullptr == parent) {
REPORTER_ASSERT(reporter, i > 2); // we need to have succeeded at least once!
return;
@@ -62,15 +62,13 @@ DEF_TEST(ColorFilter, reporter) {
// special case that would return nullptr (if color's alpha is 0 or 0xFF)
color = SkColorSetA(color, 0x7F);
- SkColorFilter* cf = SkColorFilter::CreateModeFilter(color,
- (SkXfermode::Mode)mode);
+ auto cf = SkColorFilter::MakeModeFilter(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;
@@ -98,8 +96,7 @@ DEF_TEST(ColorFilter, reporter) {
REPORTER_ASSERT(reporter, m == expectedMode);
{
- SkColorFilter* cf2 = reincarnate_colorfilter(cf);
- SkAutoUnref aur2(cf2);
+ auto cf2 = reincarnate_colorfilter(cf.get());
REPORTER_ASSERT(reporter, cf2);
SkColor c2 = ~color;
@@ -117,7 +114,7 @@ DEF_TEST(ColorFilter, reporter) {
DEF_TEST(LumaColorFilter, reporter) {
SkPMColor in, out;
- SkAutoTUnref<SkColorFilter> lf(SkLumaColorFilter::Create());
+ auto lf(SkLumaColorFilter::Make());
// Applying luma to white produces black with the same transparency.
for (unsigned i = 0; i < 256; ++i) {
@@ -183,31 +180,31 @@ static void get_grayscale_matrix(float amount, float matrix[20]) {
matrix[18] = 1.f;
}
-static SkColorFilter* make_cf0() {
+static sk_sp<SkColorFilter> make_cf0() {
SkScalar matrix[20];
get_brightness_matrix(0.5f, matrix);
- return SkColorMatrixFilter::Create(matrix);
+ return SkColorFilter::MakeMatrixFilterRowMajor255(matrix);
}
-static SkColorFilter* make_cf1() {
+static sk_sp<SkColorFilter> make_cf1() {
SkScalar matrix[20];
get_grayscale_matrix(1, matrix);
- return SkColorMatrixFilter::Create(matrix);
+ return SkColorFilter::MakeMatrixFilterRowMajor255(matrix);
}
-static SkColorFilter* make_cf2() {
+static sk_sp<SkColorFilter> make_cf2() {
SkColorMatrix m0, m1;
get_brightness_matrix(0.5f, m0.fMat);
get_grayscale_matrix(1, m1.fMat);
m0.preConcat(m1);
- return SkColorMatrixFilter::Create(m0);
+ return SkColorFilter::MakeMatrixFilterRowMajor255(m0.fMat);
}
-static SkColorFilter* make_cf3() {
+static sk_sp<SkColorFilter> make_cf3() {
SkColorMatrix m0, m1;
get_brightness_matrix(0.5f, m0.fMat);
get_grayscale_matrix(1, m1.fMat);
m0.postConcat(m1);
- return SkColorMatrixFilter::Create(m0);
+ return SkColorFilter::MakeMatrixFilterRowMajor255(m0.fMat);
}
-typedef SkColorFilter* (*CFProc)();
+typedef sk_sp<SkColorFilter> (*CFProc)();
// Test that a colormatrix that "should" preserve opaquness actually does.
DEF_TEST(ColorMatrixFilter, reporter) {
@@ -216,7 +213,7 @@ DEF_TEST(ColorMatrixFilter, reporter) {
};
for (size_t i = 0; i < SK_ARRAY_COUNT(procs); ++i) {
- SkAutoTUnref<SkColorFilter> cf(procs[i]());
+ auto cf(procs[i]());
// generate all possible r,g,b triples
for (int r = 0; r < 256; ++r) {
diff --git a/tests/ColorMatrixTest.cpp b/tests/ColorMatrixTest.cpp
index 1eea4f5a9d..7919b40242 100644
--- a/tests/ColorMatrixTest.cpp
+++ b/tests/ColorMatrixTest.cpp
@@ -45,7 +45,7 @@ static inline void test_colorMatrixCTS(skiatest::Reporter* reporter) {
0.0f, 1.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f, 0.0f };
- paint.setColorFilter(SkColorMatrixFilter::Create(blueToCyan))->unref();
+ paint.setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(blueToCyan));
paint.setColor(SK_ColorBLUE);
canvas.drawPoint(0, 0, paint);
@@ -70,7 +70,7 @@ static inline void test_colorMatrixCTS(skiatest::Reporter* reporter) {
0.0f, 0.0f, 1.0f, 0.0f, 64.0f,
-0.5f, 0.0f, 0.0f, 1.0f, 0.0f
};
- paint.setColorFilter(SkColorMatrixFilter::Create(transparentRedAddBlue))->unref();
+ paint.setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(transparentRedAddBlue));
bitmap.eraseColor(SK_ColorTRANSPARENT);
paint.setColor(SK_ColorRED);
@@ -91,7 +91,7 @@ static inline void test_colorMatrixCTS(skiatest::Reporter* reporter) {
assert_color(reporter, SK_ColorCYAN, bitmap.getColor(0, 0));
// create a new filter with the changed matrix
- paint.setColorFilter(SkColorMatrixFilter::Create(transparentRedAddBlue))->unref();
+ paint.setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(transparentRedAddBlue));
canvas.drawPoint(0, 0, paint);
assert_color(reporter, SK_ColorBLUE, bitmap.getColor(0, 0));
}
diff --git a/tests/GpuColorFilterTest.cpp b/tests/GpuColorFilterTest.cpp
index 830c7dfff3..714555a626 100644
--- a/tests/GpuColorFilterTest.cpp
+++ b/tests/GpuColorFilterTest.cpp
@@ -99,8 +99,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GpuColorFilter, reporter, context) {
GrPaint paint;
for (size_t i = 0; i < SK_ARRAY_COUNT(filterTests); ++i) {
const GetConstantComponentTestCase& test = filterTests[i];
- SkAutoTUnref<SkColorFilter> cf(
- SkColorFilter::CreateModeFilter(test.filterColor, test.filterMode));
+ auto cf(SkColorFilter::MakeModeFilter(test.filterColor, test.filterMode));
SkAutoTUnref<const GrFragmentProcessor> fp( cf->asFragmentProcessor(context));
REPORTER_ASSERT(reporter, fp);
GrInvariantOutput inout(test.inputColor,
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index fd916cfeb3..c2230b7cdb 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -137,8 +137,8 @@ static SkImageFilter* make_scale(float amount, SkImageFilter* input = nullptr) {
0, s, 0, 0, 0,
0, 0, s, 0, 0,
0, 0, 0, s, 0 };
- SkAutoTUnref<SkColorFilter> filter(SkColorMatrixFilter::Create(matrix));
- return SkColorFilterImageFilter::Create(filter, input);
+ auto filter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix));
+ return SkColorFilterImageFilter::Create(filter.get(), input);
}
static SkImageFilter* make_grayscale(SkImageFilter* input, const SkImageFilter::CropRect* cropRect) {
@@ -148,14 +148,13 @@ static SkImageFilter* make_grayscale(SkImageFilter* input, const SkImageFilter::
matrix[1] = matrix[6] = matrix[11] = 0.7152f;
matrix[2] = matrix[7] = matrix[12] = 0.0722f;
matrix[18] = 1.0f;
- SkAutoTUnref<SkColorFilter> filter(SkColorMatrixFilter::Create(matrix));
- return SkColorFilterImageFilter::Create(filter, input, cropRect);
+ auto filter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix));
+ return SkColorFilterImageFilter::Create(filter.get(), input, cropRect);
}
static SkImageFilter* make_blue(SkImageFilter* input, const SkImageFilter::CropRect* cropRect) {
- SkAutoTUnref<SkColorFilter> filter(SkColorFilter::CreateModeFilter(SK_ColorBLUE,
- SkXfermode::kSrcIn_Mode));
- return SkColorFilterImageFilter::Create(filter, input, cropRect);
+ auto filter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode));
+ return SkColorFilterImageFilter::Create(filter.get(), input, cropRect);
}
static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context,
@@ -258,9 +257,9 @@ DEF_TEST(ImageFilter, reporter) {
blueToRedMatrix[2] = blueToRedMatrix[18] = SK_Scalar1;
SkScalar redToGreenMatrix[20] = { 0 };
redToGreenMatrix[5] = redToGreenMatrix[18] = SK_Scalar1;
- SkAutoTUnref<SkColorFilter> blueToRed(SkColorMatrixFilter::Create(blueToRedMatrix));
+ auto blueToRed(SkColorFilter::MakeMatrixFilterRowMajor255(blueToRedMatrix));
SkAutoTUnref<SkImageFilter> filter1(SkColorFilterImageFilter::Create(blueToRed.get()));
- SkAutoTUnref<SkColorFilter> redToGreen(SkColorMatrixFilter::Create(redToGreenMatrix));
+ auto redToGreen(SkColorFilter::MakeMatrixFilterRowMajor255(redToGreenMatrix));
SkAutoTUnref<SkImageFilter> filter2(SkColorFilterImageFilter::Create(redToGreen.get(), filter1.get()));
SkBitmap result;
@@ -320,7 +319,7 @@ static void test_crop_rects(SkImageFilter::Proxy* proxy,
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 30, 60, 60));
SkAutoTUnref<SkImageFilter> input(make_grayscale(nullptr, &inputCropRect));
- SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode));
+ auto cf(SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode));
SkPoint3 location = SkPoint3::Make(0, 0, SK_Scalar1);
SkScalar kernel[9] = {
SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
@@ -564,7 +563,7 @@ DEF_TEST(ImageFilterDrawTiled, reporter) {
// match the same filters drawn with a single full-canvas bitmap draw.
// Tests pass by not asserting.
- SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode));
+ auto cf(SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode));
SkPoint3 location = SkPoint3::Make(0, 0, SK_Scalar1);
SkScalar kernel[9] = {
SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
@@ -693,7 +692,7 @@ static void draw_saveLayer_picture(int width, int height, int tileSize,
SkMatrix matrix;
matrix.setTranslate(SkIntToScalar(50), 0);
- SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorWHITE, SkXfermode::kSrc_Mode));
+ auto cf(SkColorFilter::MakeModeFilter(SK_ColorWHITE, SkXfermode::kSrc_Mode));
SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get()));
SkAutoTUnref<SkImageFilter> imageFilter(SkImageFilter::CreateMatrixFilter(matrix, kNone_SkFilterQuality, cfif.get()));
@@ -1122,14 +1121,13 @@ DEF_TEST(ImageFilterEmptySaveLayer, reporter) {
SkRTreeFactory factory;
SkPictureRecorder recorder;
- SkAutoTUnref<SkColorFilter> green(
- SkColorFilter::CreateModeFilter(SK_ColorGREEN, SkXfermode::kSrc_Mode));
+ auto green(SkColorFilter::MakeModeFilter(SK_ColorGREEN, SkXfermode::kSrc_Mode));
SkAutoTUnref<SkImageFilter> imageFilter(
SkColorFilterImageFilter::Create(green.get()));
SkPaint imageFilterPaint;
imageFilterPaint.setImageFilter(imageFilter.get());
SkPaint colorFilterPaint;
- colorFilterPaint.setColorFilter(green.get());
+ colorFilterPaint.setColorFilter(green);
SkRect bounds = SkRect::MakeWH(10, 10);
@@ -1245,8 +1243,7 @@ static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* re
bitmap.allocN32Pixels(1, 1);
bitmap.eraseARGB(255, 255, 255, 255);
- SkAutoTUnref<SkColorFilter> green(
- SkColorFilter::CreateModeFilter(SK_ColorGREEN, SkXfermode::kSrcIn_Mode));
+ auto green(SkColorFilter::MakeModeFilter(SK_ColorGREEN, SkXfermode::kSrcIn_Mode));
SkAutoTUnref<SkImageFilter> greenFilter(SkColorFilterImageFilter::Create(green.get()));
SkImageFilter::CropRect cropRect(SkRect::MakeEmpty());
SkAutoTUnref<SkImageFilter> croppedOut(
@@ -1467,8 +1464,8 @@ DEF_TEST(ImageFilterCanComputeFastBounds, reporter) {
0, 0, 0, 0, 1,
0, 0, 0, 0, 0,
0, 0, 0, 0, 1 };
- SkAutoTUnref<SkColorFilter> greenCF(SkColorMatrixFilter::Create(greenMatrix));
- SkAutoTUnref<SkImageFilter> green(SkColorFilterImageFilter::Create(greenCF));
+ auto greenCF(SkColorFilter::MakeMatrixFilterRowMajor255(greenMatrix));
+ SkAutoTUnref<SkImageFilter> green(SkColorFilterImageFilter::Create(greenCF.get()));
REPORTER_ASSERT(reporter, greenCF->affectsTransparentBlack());
REPORTER_ASSERT(reporter, !green->canComputeFastBounds());
@@ -1482,14 +1479,12 @@ DEF_TEST(ImageFilterCanComputeFastBounds, reporter) {
allOne[i] = 255;
}
- SkAutoTUnref<SkColorFilter> identityCF(
- SkTableColorFilter::CreateARGB(identity, identity, identity, allOne));
+ auto identityCF(SkTableColorFilter::MakeARGB(identity, identity, identity, allOne));
SkAutoTUnref<SkImageFilter> identityFilter(SkColorFilterImageFilter::Create(identityCF.get()));
REPORTER_ASSERT(reporter, !identityCF->affectsTransparentBlack());
REPORTER_ASSERT(reporter, identityFilter->canComputeFastBounds());
- SkAutoTUnref<SkColorFilter> forceOpaqueCF(
- SkTableColorFilter::CreateARGB(allOne, identity, identity, identity));
+ auto forceOpaqueCF(SkTableColorFilter::MakeARGB(allOne, identity, identity, identity));
SkAutoTUnref<SkImageFilter> forceOpaque(SkColorFilterImageFilter::Create(forceOpaqueCF.get()));
REPORTER_ASSERT(reporter, forceOpaqueCF->affectsTransparentBlack());
REPORTER_ASSERT(reporter, !forceOpaque->canComputeFastBounds());
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index a58bd864ec..0e92e65ba3 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -360,11 +360,11 @@ DEF_TEST(Paint_nothingToDraw, r) {
SkColorMatrix cm;
cm.setIdentity(); // does not change alpha
- paint.setColorFilter(SkColorMatrixFilter::Create(cm))->unref();
+ paint.setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat));
REPORTER_ASSERT(r, paint.nothingToDraw());
cm.postTranslate(0, 0, 0, 1); // wacks alpha
- paint.setColorFilter(SkColorMatrixFilter::Create(cm))->unref();
+ paint.setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat));
REPORTER_ASSERT(r, !paint.nothingToDraw());
}
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 58a08ecc34..a57a1b2fb2 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -278,7 +278,7 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) {
// optimize away
SkScalar blueToRedMatrix[20] = { 0 };
blueToRedMatrix[2] = blueToRedMatrix[18] = SK_Scalar1;
- SkAutoTUnref<SkColorFilter> blueToRed(SkColorMatrixFilter::Create(blueToRedMatrix));
+ auto blueToRed(SkColorFilter::MakeMatrixFilterRowMajor255(blueToRedMatrix));
SkAutoTUnref<SkImageFilter> filter(SkColorFilterImageFilter::Create(blueToRed.get()));
SkPaint complexPaint;
diff --git a/tests/RecordOptsTest.cpp b/tests/RecordOptsTest.cpp
index 597639e543..77eb76bc02 100644
--- a/tests/RecordOptsTest.cpp
+++ b/tests/RecordOptsTest.cpp
@@ -224,7 +224,7 @@ DEF_TEST(RecordOpts_MergeSvgOpacityAndFilterLayers, r) {
xfermodePaint.setXfermodeMode(SkXfermode::kDstIn_Mode);
SkPaint colorFilterPaint;
colorFilterPaint.setColorFilter(
- SkColorFilter::CreateModeFilter(SK_ColorLTGRAY, SkXfermode::kSrcIn_Mode))->unref();
+ SkColorFilter::MakeModeFilter(SK_ColorLTGRAY, SkXfermode::kSrcIn_Mode));
SkPaint opaqueFilterLayerPaint;
opaqueFilterLayerPaint.setColor(0xFF020202); // Opaque.
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index c58020724d..f8d6ea4297 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -286,7 +286,7 @@ static void TestColorFilterSerialization(skiatest::Reporter* reporter) {
for (int i = 0; i < 256; ++i) {
table[i] = (i * 41) % 256;
}
- SkAutoTUnref<SkColorFilter> colorFilter(SkTableColorFilter::Create(table));
+ auto colorFilter(SkTableColorFilter::Make(table));
SkAutoTUnref<SkColorFilter> copy(
TestFlattenableSerialization<SkColorFilter>(colorFilter.get(), true, reporter));
}
diff --git a/tests/SkColor4fTest.cpp b/tests/SkColor4fTest.cpp
index 94e1b68816..239004aacb 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];