Update SkXfermodeImageFilter to sk_sp
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1852123002
Committed: https://skia.googlesource.com/skia/+/3bc969264d4720d67f0b137552b3777a03b431a8
Review URL: https://codereview.chromium.org/1852123002
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 42613a3..02496e2 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -261,8 +261,7 @@
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 @@
// 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 @@
}
{
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 @@
// 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 @@
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);