diff options
author | reed <reed@google.com> | 2016-03-22 08:59:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-22 08:59:19 -0700 |
commit | d6889293dd0942f27f9593f679722c956831f2c4 (patch) | |
tree | e7c4f9aa9ee2c4e318e8e5c8d69f6918fba1e865 /tests | |
parent | 1088db92348baa013511a49392178fccf03e8008 (diff) |
Revert of Revert[2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (patchset #3 id:40001 of https://codereview.chromium.org/1825073002/ )
Reason for revert:
CreateModeFilter not compiling
Original issue's description:
> 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=
>
> Committed: https://skia.googlesource.com/skia/+/4c9776b046dd5e9e46e2d1ce35154855c8fcb381
TBR=
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1821103004
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ColorFilterTest.cpp | 41 | ||||
-rw-r--r-- | tests/ColorMatrixTest.cpp | 6 | ||||
-rw-r--r-- | tests/GpuColorFilterTest.cpp | 3 | ||||
-rw-r--r-- | tests/ImageFilterTest.cpp | 41 | ||||
-rw-r--r-- | tests/PaintTest.cpp | 4 | ||||
-rw-r--r-- | tests/PictureTest.cpp | 2 | ||||
-rw-r--r-- | tests/RecordOptsTest.cpp | 2 | ||||
-rw-r--r-- | tests/SerializationTest.cpp | 2 | ||||
-rw-r--r-- | tests/SkColor4fTest.cpp | 25 |
9 files changed, 69 insertions, 57 deletions
diff --git a/tests/ColorFilterTest.cpp b/tests/ColorFilterTest.cpp index 822fb0bd70..ee8f12b2fb 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> reincarnate_colorfilter(SkFlattenable* obj) { /////////////////////////////////////////////////////////////////////////////// -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 @@ DEF_TEST(ColorFilter, reporter) { // 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 @@ DEF_TEST(ColorFilter, reporter) { 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(ColorFilter, reporter) { 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 @@ static void get_grayscale_matrix(float amount, float matrix[20]) { 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); + return SkColorMatrixFilter::Create(matrix); } -static sk_sp<SkColorFilter> make_cf1() { +static SkColorFilter* make_cf1() { SkScalar matrix[20]; get_grayscale_matrix(1, matrix); - return SkColorFilter::MakeMatrixFilterRowMajor255(matrix); + return SkColorMatrixFilter::Create(matrix); } -static sk_sp<SkColorFilter> make_cf2() { +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); + return SkColorMatrixFilter::Create(m0); } -static sk_sp<SkColorFilter> make_cf3() { +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); + return SkColorMatrixFilter::Create(m0); } -typedef sk_sp<SkColorFilter> (*CFProc)(); +typedef SkColorFilter* (*CFProc)(); // Test that a colormatrix that "should" preserve opaquness actually does. DEF_TEST(ColorMatrixFilter, reporter) { @@ -213,7 +216,7 @@ DEF_TEST(ColorMatrixFilter, reporter) { }; 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) { diff --git a/tests/ColorMatrixTest.cpp b/tests/ColorMatrixTest.cpp index 7919b40242..1eea4f5a9d 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(SkColorFilter::MakeMatrixFilterRowMajor255(blueToCyan)); + paint.setColorFilter(SkColorMatrixFilter::Create(blueToCyan))->unref(); 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(SkColorFilter::MakeMatrixFilterRowMajor255(transparentRedAddBlue)); + paint.setColorFilter(SkColorMatrixFilter::Create(transparentRedAddBlue))->unref(); 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(SkColorFilter::MakeMatrixFilterRowMajor255(transparentRedAddBlue)); + paint.setColorFilter(SkColorMatrixFilter::Create(transparentRedAddBlue))->unref(); 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 714555a626..830c7dfff3 100644 --- a/tests/GpuColorFilterTest.cpp +++ b/tests/GpuColorFilterTest.cpp @@ -99,7 +99,8 @@ 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]; - auto cf(SkColorFilter::MakeModeFilter(test.filterColor, test.filterMode)); + SkAutoTUnref<SkColorFilter> cf( + SkColorFilter::CreateModeFilter(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 c2230b7cdb..fd916cfeb3 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 }; - auto filter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix)); - return SkColorFilterImageFilter::Create(filter.get(), input); + SkAutoTUnref<SkColorFilter> filter(SkColorMatrixFilter::Create(matrix)); + return SkColorFilterImageFilter::Create(filter, input); } static SkImageFilter* make_grayscale(SkImageFilter* input, const SkImageFilter::CropRect* cropRect) { @@ -148,13 +148,14 @@ 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; - auto filter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix)); - return SkColorFilterImageFilter::Create(filter.get(), input, cropRect); + SkAutoTUnref<SkColorFilter> filter(SkColorMatrixFilter::Create(matrix)); + return SkColorFilterImageFilter::Create(filter, input, cropRect); } static SkImageFilter* make_blue(SkImageFilter* input, const SkImageFilter::CropRect* cropRect) { - auto filter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode)); - return SkColorFilterImageFilter::Create(filter.get(), input, cropRect); + SkAutoTUnref<SkColorFilter> filter(SkColorFilter::CreateModeFilter(SK_ColorBLUE, + SkXfermode::kSrcIn_Mode)); + return SkColorFilterImageFilter::Create(filter, input, cropRect); } static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context, @@ -257,9 +258,9 @@ DEF_TEST(ImageFilter, reporter) { blueToRedMatrix[2] = blueToRedMatrix[18] = SK_Scalar1; SkScalar redToGreenMatrix[20] = { 0 }; redToGreenMatrix[5] = redToGreenMatrix[18] = SK_Scalar1; - auto blueToRed(SkColorFilter::MakeMatrixFilterRowMajor255(blueToRedMatrix)); + SkAutoTUnref<SkColorFilter> blueToRed(SkColorMatrixFilter::Create(blueToRedMatrix)); SkAutoTUnref<SkImageFilter> filter1(SkColorFilterImageFilter::Create(blueToRed.get())); - auto redToGreen(SkColorFilter::MakeMatrixFilterRowMajor255(redToGreenMatrix)); + SkAutoTUnref<SkColorFilter> redToGreen(SkColorMatrixFilter::Create(redToGreenMatrix)); SkAutoTUnref<SkImageFilter> filter2(SkColorFilterImageFilter::Create(redToGreen.get(), filter1.get())); SkBitmap result; @@ -319,7 +320,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)); - auto cf(SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode)); + SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode)); SkPoint3 location = SkPoint3::Make(0, 0, SK_Scalar1); SkScalar kernel[9] = { SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), @@ -563,7 +564,7 @@ DEF_TEST(ImageFilterDrawTiled, reporter) { // match the same filters drawn with a single full-canvas bitmap draw. // Tests pass by not asserting. - auto cf(SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode)); + SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode)); SkPoint3 location = SkPoint3::Make(0, 0, SK_Scalar1); SkScalar kernel[9] = { SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), @@ -692,7 +693,7 @@ static void draw_saveLayer_picture(int width, int height, int tileSize, SkMatrix matrix; matrix.setTranslate(SkIntToScalar(50), 0); - auto cf(SkColorFilter::MakeModeFilter(SK_ColorWHITE, SkXfermode::kSrc_Mode)); + SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorWHITE, SkXfermode::kSrc_Mode)); SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get())); SkAutoTUnref<SkImageFilter> imageFilter(SkImageFilter::CreateMatrixFilter(matrix, kNone_SkFilterQuality, cfif.get())); @@ -1121,13 +1122,14 @@ DEF_TEST(ImageFilterEmptySaveLayer, reporter) { SkRTreeFactory factory; SkPictureRecorder recorder; - auto green(SkColorFilter::MakeModeFilter(SK_ColorGREEN, SkXfermode::kSrc_Mode)); + SkAutoTUnref<SkColorFilter> green( + SkColorFilter::CreateModeFilter(SK_ColorGREEN, SkXfermode::kSrc_Mode)); SkAutoTUnref<SkImageFilter> imageFilter( SkColorFilterImageFilter::Create(green.get())); SkPaint imageFilterPaint; imageFilterPaint.setImageFilter(imageFilter.get()); SkPaint colorFilterPaint; - colorFilterPaint.setColorFilter(green); + colorFilterPaint.setColorFilter(green.get()); SkRect bounds = SkRect::MakeWH(10, 10); @@ -1243,7 +1245,8 @@ static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* re bitmap.allocN32Pixels(1, 1); bitmap.eraseARGB(255, 255, 255, 255); - auto green(SkColorFilter::MakeModeFilter(SK_ColorGREEN, SkXfermode::kSrcIn_Mode)); + SkAutoTUnref<SkColorFilter> green( + SkColorFilter::CreateModeFilter(SK_ColorGREEN, SkXfermode::kSrcIn_Mode)); SkAutoTUnref<SkImageFilter> greenFilter(SkColorFilterImageFilter::Create(green.get())); SkImageFilter::CropRect cropRect(SkRect::MakeEmpty()); SkAutoTUnref<SkImageFilter> croppedOut( @@ -1464,8 +1467,8 @@ DEF_TEST(ImageFilterCanComputeFastBounds, reporter) { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; - auto greenCF(SkColorFilter::MakeMatrixFilterRowMajor255(greenMatrix)); - SkAutoTUnref<SkImageFilter> green(SkColorFilterImageFilter::Create(greenCF.get())); + SkAutoTUnref<SkColorFilter> greenCF(SkColorMatrixFilter::Create(greenMatrix)); + SkAutoTUnref<SkImageFilter> green(SkColorFilterImageFilter::Create(greenCF)); REPORTER_ASSERT(reporter, greenCF->affectsTransparentBlack()); REPORTER_ASSERT(reporter, !green->canComputeFastBounds()); @@ -1479,12 +1482,14 @@ DEF_TEST(ImageFilterCanComputeFastBounds, reporter) { allOne[i] = 255; } - auto identityCF(SkTableColorFilter::MakeARGB(identity, identity, identity, allOne)); + SkAutoTUnref<SkColorFilter> identityCF( + SkTableColorFilter::CreateARGB(identity, identity, identity, allOne)); SkAutoTUnref<SkImageFilter> identityFilter(SkColorFilterImageFilter::Create(identityCF.get())); REPORTER_ASSERT(reporter, !identityCF->affectsTransparentBlack()); REPORTER_ASSERT(reporter, identityFilter->canComputeFastBounds()); - auto forceOpaqueCF(SkTableColorFilter::MakeARGB(allOne, identity, identity, identity)); + SkAutoTUnref<SkColorFilter> forceOpaqueCF( + SkTableColorFilter::CreateARGB(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 0e92e65ba3..a58bd864ec 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(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat)); + paint.setColorFilter(SkColorMatrixFilter::Create(cm))->unref(); REPORTER_ASSERT(r, paint.nothingToDraw()); cm.postTranslate(0, 0, 0, 1); // wacks alpha - paint.setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat)); + paint.setColorFilter(SkColorMatrixFilter::Create(cm))->unref(); REPORTER_ASSERT(r, !paint.nothingToDraw()); } diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp index a57a1b2fb2..58a08ecc34 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; - auto blueToRed(SkColorFilter::MakeMatrixFilterRowMajor255(blueToRedMatrix)); + SkAutoTUnref<SkColorFilter> blueToRed(SkColorMatrixFilter::Create(blueToRedMatrix)); SkAutoTUnref<SkImageFilter> filter(SkColorFilterImageFilter::Create(blueToRed.get())); SkPaint complexPaint; diff --git a/tests/RecordOptsTest.cpp b/tests/RecordOptsTest.cpp index 77eb76bc02..597639e543 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::MakeModeFilter(SK_ColorLTGRAY, SkXfermode::kSrcIn_Mode)); + SkColorFilter::CreateModeFilter(SK_ColorLTGRAY, SkXfermode::kSrcIn_Mode))->unref(); SkPaint opaqueFilterLayerPaint; opaqueFilterLayerPaint.setColor(0xFF020202); // Opaque. diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp index f8d6ea4297..c58020724d 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; } - auto colorFilter(SkTableColorFilter::Make(table)); + SkAutoTUnref<SkColorFilter> colorFilter(SkTableColorFilter::Create(table)); SkAutoTUnref<SkColorFilter> copy( TestFlattenableSerialization<SkColorFilter>(colorFilter.get(), true, reporter)); } diff --git a/tests/SkColor4fTest.cpp b/tests/SkColor4fTest.cpp index 239004aacb..94e1b68816 100644 --- a/tests/SkColor4fTest.cpp +++ b/tests/SkColor4fTest.cpp @@ -78,22 +78,24 @@ DEF_TEST(Color4f_premul, reporter) { ////////////////////////////////////////////////////////////////////////////////////////////////// -static sk_sp<SkColorFilter> make_mode_cf() { - return SkColorFilter::MakeModeFilter(0xFFBB8855, SkXfermode::kPlus_Mode); +static SkColorFilter* make_mode_cf() { + return SkColorFilter::CreateModeFilter(0xFFBB8855, SkXfermode::kPlus_Mode); } -static sk_sp<SkColorFilter> make_mx_cf() { +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); + return SkColorMatrixFilter::Create(mx); } -static sk_sp<SkColorFilter> make_compose_cf() { - return SkColorFilter::MakeComposeFilter(make_mode_cf(), make_mx_cf()); +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_grad_sh() { } 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_shader, reporter) { 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 @@ DEF_TEST(Color4f_colorfilter, reporter) { 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]; |