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

Unified Diff: tests/ImageFilterTest.cpp

Issue 1869833002: Update MatrixConvolutionImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 8 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/effects/SkMatrixConvolutionImageFilter.cpp ('k') | no next file » | 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 e153cc0a92d3a01842f037977418700feec7e800..f1df84e20b04adc3204f96b20e7be2228f2a0232 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -191,10 +191,10 @@ public:
SkLightingImageFilter::CreatePointLitSpecular(location, SK_ColorGREEN, 0, 0, 0,
input.get(), cropRect));
this->addFilter("matrix convolution",
- SkMatrixConvolutionImageFilter::Create(
+ SkMatrixConvolutionImageFilter::Make(
kernelSize, kernel, gain, bias, SkIPoint::Make(1, 1),
SkMatrixConvolutionImageFilter::kRepeat_TileMode, false,
- input.get(), cropRect));
+ input, cropRect).release());
this->addFilter("merge", SkMergeImageFilter::Make(input, input,
SkXfermode::kSrcOver_Mode,
cropRect).release());
@@ -1033,10 +1033,11 @@ DEF_TEST(ImageFilterMatrixConvolution, reporter) {
SkScalar gain = SK_Scalar1, bias = 0;
SkIPoint kernelOffset = SkIPoint::Make(0, 0);
- SkAutoTUnref<SkImageFilter> filter(
- SkMatrixConvolutionImageFilter::Create(
- kernelSize, kernel, gain, bias, kernelOffset,
- SkMatrixConvolutionImageFilter::kRepeat_TileMode, false));
+ sk_sp<SkImageFilter> filter(SkMatrixConvolutionImageFilter::Make(
+ kernelSize, kernel,
+ gain, bias, kernelOffset,
+ SkMatrixConvolutionImageFilter::kRepeat_TileMode,
+ false, nullptr));
SkBitmap result;
int width = 16, height = 16;
@@ -1045,7 +1046,7 @@ DEF_TEST(ImageFilterMatrixConvolution, reporter) {
canvas.clear(0);
SkPaint paint;
- paint.setImageFilter(filter);
+ paint.setImageFilter(std::move(filter));
SkRect rect = SkRect::Make(SkIRect::MakeWH(width, height));
canvas.drawRect(rect, paint);
}
@@ -1060,10 +1061,10 @@ DEF_TEST(ImageFilterMatrixConvolutionBorder, reporter) {
SkScalar gain = SK_Scalar1, bias = 0;
SkIPoint kernelOffset = SkIPoint::Make(2, 0);
- SkAutoTUnref<SkImageFilter> filter(
- SkMatrixConvolutionImageFilter::Create(
- kernelSize, kernel, gain, bias, kernelOffset,
- SkMatrixConvolutionImageFilter::kClamp_TileMode, true));
+ sk_sp<SkImageFilter> filter(SkMatrixConvolutionImageFilter::Make(
+ kernelSize, kernel, gain, bias, kernelOffset,
+ SkMatrixConvolutionImageFilter::kClamp_TileMode,
+ true, nullptr));
SkBitmap result;
@@ -1073,7 +1074,7 @@ DEF_TEST(ImageFilterMatrixConvolutionBorder, reporter) {
canvas.clear(0);
SkPaint filterPaint;
- filterPaint.setImageFilter(filter);
+ filterPaint.setImageFilter(std::move(filter));
SkRect bounds = SkRect::MakeWH(1, 10);
SkRect rect = SkRect::Make(SkIRect::MakeWH(width, height));
SkPaint rectPaint;
@@ -1293,50 +1294,54 @@ DEF_TEST(MatrixConvolutionSanityTest, reporter) {
SkIPoint kernelOffset = SkIPoint::Make(1, 1);
// Check that an enormous (non-allocatable) kernel gives a nullptr filter.
- SkAutoTUnref<SkImageFilter> conv(SkMatrixConvolutionImageFilter::Create(
+ sk_sp<SkImageFilter> conv(SkMatrixConvolutionImageFilter::Make(
SkISize::Make(1<<30, 1<<30),
kernel,
gain,
bias,
kernelOffset,
SkMatrixConvolutionImageFilter::kRepeat_TileMode,
- false));
+ false,
+ nullptr));
REPORTER_ASSERT(reporter, nullptr == conv.get());
// Check that a nullptr kernel gives a nullptr filter.
- conv.reset(SkMatrixConvolutionImageFilter::Create(
+ conv = SkMatrixConvolutionImageFilter::Make(
SkISize::Make(1, 1),
nullptr,
gain,
bias,
kernelOffset,
SkMatrixConvolutionImageFilter::kRepeat_TileMode,
- false));
+ false,
+ nullptr);
REPORTER_ASSERT(reporter, nullptr == conv.get());
// Check that a kernel width < 1 gives a nullptr filter.
- conv.reset(SkMatrixConvolutionImageFilter::Create(
+ conv = SkMatrixConvolutionImageFilter::Make(
SkISize::Make(0, 1),
kernel,
gain,
bias,
kernelOffset,
SkMatrixConvolutionImageFilter::kRepeat_TileMode,
- false));
+ false,
+ nullptr);
REPORTER_ASSERT(reporter, nullptr == conv.get());
// Check that kernel height < 1 gives a nullptr filter.
- conv.reset(SkMatrixConvolutionImageFilter::Create(
+ conv = SkMatrixConvolutionImageFilter::Make(
SkISize::Make(1, -1),
kernel,
gain,
bias,
kernelOffset,
SkMatrixConvolutionImageFilter::kRepeat_TileMode,
- false));
+ false,
+ nullptr);
REPORTER_ASSERT(reporter, nullptr == conv.get());
}
« no previous file with comments | « src/effects/SkMatrixConvolutionImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698