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

Unified Diff: tests/ImageFilterTest.cpp

Issue 1832223002: switch xfermodes over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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
Index: tests/ImageFilterTest.cpp
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index e4ab1ace07d5d3de7686cb0db96ef88af951d41e..9d2039687d325397256f32ba3b0b10173dcf5481 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -191,8 +191,8 @@ public:
five, five, pictureFilter.get(), cropRect));
this->addFilter("paint and blur", SkBlurImageFilter::Create(
five, five, paintFilter.get(), cropRect));
- this->addFilter("xfermode", SkXfermodeImageFilter::Create(
- SkXfermode::Create(SkXfermode::kSrc_Mode), input, input, cropRect));
+ this->addFilter("xfermode", SkXfermodeImageFilter::Make(
+ SkXfermode::Make(SkXfermode::kSrc_Mode), input, input, cropRect).release());
}
int count() const { return fFilters.count(); }
SkImageFilter* getFilter(int index) const { return fFilters[index].fFilter.get(); }
@@ -799,16 +799,15 @@ DEF_TEST(ImageFilterUnionBounds, reporter) {
// Regardless of which order they appear in, the image filter bounds should
// be combined correctly.
{
- SkAutoTUnref<SkImageFilter> composite(SkXfermodeImageFilter::Create(
- nullptr, offset.get(), nullptr));
+ sk_sp<SkImageFilter> composite(SkXfermodeImageFilter::Make(nullptr, offset.get()));
SkRect bounds = SkRect::MakeWH(100, 100);
// Intentionally aliasing here, as that's what the real callers do.
bounds = composite->computeFastBounds(bounds);
REPORTER_ASSERT(reporter, bounds == SkRect::MakeWH(150, 100));
}
{
- SkAutoTUnref<SkImageFilter> composite(SkXfermodeImageFilter::Create(
- nullptr, nullptr, offset.get()));
+ sk_sp<SkImageFilter> composite(SkXfermodeImageFilter::Make(nullptr, nullptr,
+ offset.get(), nullptr));
SkRect bounds = SkRect::MakeWH(100, 100);
// Intentionally aliasing here, as that's what the real callers do.
bounds = composite->computeFastBounds(bounds);
@@ -1249,13 +1248,10 @@ static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* re
// Check that an xfermode image filter whose input has been cropped out still draws the other
// input. Also check that drawing with both inputs cropped out doesn't cause a GPU warning.
- SkXfermode* mode = SkXfermode::Create(SkXfermode::kSrcOver_Mode);
- SkAutoTUnref<SkImageFilter> xfermodeNoFg(
- SkXfermodeImageFilter::Create(mode, greenFilter, croppedOut));
- SkAutoTUnref<SkImageFilter> xfermodeNoBg(
- SkXfermodeImageFilter::Create(mode, croppedOut, greenFilter));
- SkAutoTUnref<SkImageFilter> xfermodeNoFgNoBg(
- SkXfermodeImageFilter::Create(mode, croppedOut, croppedOut));
+ auto mode = SkXfermode::Make(SkXfermode::kSrcOver_Mode);
+ auto xfermodeNoFg(SkXfermodeImageFilter::Make(mode, greenFilter, croppedOut, nullptr));
+ auto xfermodeNoBg(SkXfermodeImageFilter::Make(mode, croppedOut, greenFilter, nullptr));
+ auto xfermodeNoFgNoBg(SkXfermodeImageFilter::Make(mode, croppedOut, croppedOut, nullptr));
SkPaint paint;
paint.setImageFilter(xfermodeNoFg);

Powered by Google App Engine
This is Rietveld 408576698