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

Unified Diff: tests/ImageFilterTest.cpp

Issue 1852123002: Update SkXfermodeImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Overload Make methods 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/SkXfermodeImageFilter.cpp ('k') | tests/ImageFilterTest.cpp.orig » ('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 42613a35c50257500c01a42dd7a039a09b355005..02496e22a99acfe36964623a68239e30d09e2cf7 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -261,8 +261,7 @@ public:
cropRect).release());
}
this->addFilter("xfermode", SkXfermodeImageFilter::Make(
- SkXfermode::Make(SkXfermode::kSrc_Mode), input.get(), input.get(),
- cropRect).release());
+ 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(); }
@@ -911,7 +910,7 @@ DEF_TEST(ImageFilterUnionBounds, reporter) {
// Regardless of which order they appear in, the image filter bounds should
// be combined correctly.
{
- sk_sp<SkImageFilter> composite(SkXfermodeImageFilter::Make(nullptr, offset.get()));
+ sk_sp<SkImageFilter> composite(SkXfermodeImageFilter::Make(nullptr, offset));
SkRect bounds = SkRect::MakeWH(100, 100);
// Intentionally aliasing here, as that's what the real callers do.
bounds = composite->computeFastBounds(bounds);
@@ -919,7 +918,7 @@ DEF_TEST(ImageFilterUnionBounds, reporter) {
}
{
sk_sp<SkImageFilter> composite(SkXfermodeImageFilter::Make(nullptr, nullptr,
- offset.get(), nullptr));
+ offset, nullptr));
SkRect bounds = SkRect::MakeWH(100, 100);
// Intentionally aliasing here, as that's what the real callers do.
bounds = composite->computeFastBounds(bounds);
@@ -1357,17 +1356,16 @@ 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.
- auto mode = SkXfermode::Make(SkXfermode::kSrcOver_Mode);
- auto xfermodeNoFg(SkXfermodeImageFilter::Make(mode,
- greenFilter.get(), croppedOut.get(), nullptr));
- auto xfermodeNoBg(SkXfermodeImageFilter::Make(mode,
- croppedOut.get(), greenFilter.get(), nullptr));
- auto xfermodeNoFgNoBg(SkXfermodeImageFilter::Make(mode,
- croppedOut.get(),
- croppedOut.get(), nullptr));
+ sk_sp<SkXfermode> mode(SkXfermode::Make(SkXfermode::kSrcOver_Mode));
+ sk_sp<SkImageFilter> xfermodeNoFg(SkXfermodeImageFilter::Make(mode, greenFilter,
+ croppedOut, nullptr));
+ sk_sp<SkImageFilter> xfermodeNoBg(SkXfermodeImageFilter::Make(mode, croppedOut,
+ greenFilter, nullptr));
+ sk_sp<SkImageFilter> xfermodeNoFgNoBg(SkXfermodeImageFilter::Make(mode, croppedOut,
+ croppedOut, nullptr));
SkPaint paint;
- paint.setImageFilter(xfermodeNoFg);
+ paint.setImageFilter(std::move(xfermodeNoFg));
canvas->drawBitmap(bitmap, 0, 0, &paint); // drawSprite
uint32_t pixel;
@@ -1375,12 +1373,12 @@ static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* re
canvas->readPixels(info, &pixel, 4, 0, 0);
REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN);
- paint.setImageFilter(xfermodeNoBg);
+ paint.setImageFilter(std::move(xfermodeNoBg));
canvas->drawBitmap(bitmap, 0, 0, &paint); // drawSprite
canvas->readPixels(info, &pixel, 4, 0, 0);
REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN);
- paint.setImageFilter(xfermodeNoFgNoBg);
+ paint.setImageFilter(std::move(xfermodeNoFgNoBg));
canvas->drawBitmap(bitmap, 0, 0, &paint); // drawSprite
canvas->readPixels(info, &pixel, 4, 0, 0);
REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN);
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | tests/ImageFilterTest.cpp.orig » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698