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

Unified Diff: tests/ImageFilterTest.cpp

Issue 1852273002: Revert of Update SkXfermodeImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/SerializationTest.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 af11bb47fd95a84c9b0e6a760d4b182aef563400..48d3147ef9d275bb58d6cdd6df61947f7b179dbc 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -231,10 +231,7 @@
cropRect).release());
}
this->addFilter("xfermode", SkXfermodeImageFilter::Make(
- SkXfermode::Make(SkXfermode::kSrc_Mode),
- sk_ref_sp<SkImageFilter>(input),
- sk_ref_sp<SkImageFilter>(input),
- 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(); }
@@ -842,7 +839,7 @@
// Regardless of which order they appear in, the image filter bounds should
// be combined correctly.
{
- sk_sp<SkImageFilter> composite(SkXfermodeImageFilter::Make(nullptr, offset));
+ 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);
@@ -850,7 +847,7 @@
}
{
sk_sp<SkImageFilter> composite(SkXfermodeImageFilter::Make(nullptr, nullptr,
- offset, 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);
@@ -1280,25 +1277,21 @@
bitmap.allocN32Pixels(1, 1);
bitmap.eraseARGB(255, 255, 255, 255);
- sk_sp<SkColorFilter> green(SkColorFilter::MakeModeFilter(SK_ColorGREEN,
- SkXfermode::kSrcIn_Mode));
- sk_sp<SkImageFilter> greenFilter(SkColorFilterImageFilter::Create(green.get()));
+ auto green(SkColorFilter::MakeModeFilter(SK_ColorGREEN, SkXfermode::kSrcIn_Mode));
+ SkAutoTUnref<SkImageFilter> greenFilter(SkColorFilterImageFilter::Create(green.get()));
SkImageFilter::CropRect cropRect(SkRect::MakeEmpty());
- sk_sp<SkImageFilter> croppedOut(
+ SkAutoTUnref<SkImageFilter> croppedOut(
SkColorFilterImageFilter::Create(green.get(), nullptr, &cropRect));
// 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.
- 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));
+ 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(std::move(xfermodeNoFg));
+ paint.setImageFilter(xfermodeNoFg);
canvas->drawBitmap(bitmap, 0, 0, &paint); // drawSprite
uint32_t pixel;
@@ -1306,12 +1299,12 @@
canvas->readPixels(info, &pixel, 4, 0, 0);
REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN);
- paint.setImageFilter(std::move(xfermodeNoBg));
+ paint.setImageFilter(xfermodeNoBg);
canvas->drawBitmap(bitmap, 0, 0, &paint); // drawSprite
canvas->readPixels(info, &pixel, 4, 0, 0);
REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN);
- paint.setImageFilter(std::move(xfermodeNoFgNoBg));
+ paint.setImageFilter(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/SerializationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698