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

Unified Diff: tests/ImageFilterTest.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/GpuColorFilterTest.cpp ('k') | tests/PaintTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageFilterTest.cpp
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index c2230b7cdb8733c9edae75a6cd983e8086a4abfa..fd916cfeb3b9d494d7121cac63aad317ae31bb01 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -137,8 +137,8 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
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());
« no previous file with comments | « tests/GpuColorFilterTest.cpp ('k') | tests/PaintTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698