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

Unified Diff: gm/xfermodeimagefilter.cpp

Issue 1842243002: Update SkImageSource to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up 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: gm/xfermodeimagefilter.cpp
diff --git a/gm/xfermodeimagefilter.cpp b/gm/xfermodeimagefilter.cpp
index 90e2dd0c2b7f035f0d3d85538e2cf37e8a697b2e..67246540782256456086cbb0b75ad59bcc3f7426 100644
--- a/gm/xfermodeimagefilter.cpp
+++ b/gm/xfermodeimagefilter.cpp
@@ -85,10 +85,10 @@ protected:
};
int x = 0, y = 0;
- SkAutoTUnref<SkImageFilter> background(SkImageSource::Create(fCheckerboard.get()));
+ sk_sp<SkImageFilter> background(SkImageSource::Make(fCheckerboard));
for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); i++) {
paint.setImageFilter(SkXfermodeImageFilter::Make(SkXfermode::Make(gModes[i].fMode),
- background));
+ background.get()));
DrawClippedBitmap(canvas, fBitmap, paint, x, y);
x += fBitmap.width() + MARGIN;
if (x + fBitmap.width() > WIDTH) {
@@ -98,7 +98,7 @@ protected:
}
// Test arithmetic mode as image filter
paint.setImageFilter(SkXfermodeImageFilter::Make(
- SkArithmeticMode::Make(0, SK_Scalar1, SK_Scalar1, 0), background));
+ SkArithmeticMode::Make(0, SK_Scalar1, SK_Scalar1, 0), background.get()));
DrawClippedBitmap(canvas, fBitmap, paint, x, y);
x += fBitmap.width() + MARGIN;
if (x + fBitmap.width() > WIDTH) {
@@ -106,7 +106,7 @@ protected:
y += fBitmap.height() + MARGIN;
}
// Test nullptr mode
- paint.setImageFilter(SkXfermodeImageFilter::Make(nullptr, background));
+ paint.setImageFilter(SkXfermodeImageFilter::Make(nullptr, background.get()));
DrawClippedBitmap(canvas, fBitmap, paint, x, y);
x += fBitmap.width() + MARGIN;
if (x + fBitmap.width() > WIDTH) {
@@ -117,11 +117,11 @@ protected:
SkIntToScalar(fBitmap.height() + 4));
// Test offsets on SrcMode (uses fixed-function blend)
sk_sp<SkImage> bitmapImage(SkImage::MakeFromBitmap(fBitmap));
- SkAutoTUnref<SkImageFilter> foreground(SkImageSource::Create(bitmapImage.get()));
+ sk_sp<SkImageFilter> foreground(SkImageSource::Make(std::move(bitmapImage)));
SkAutoTUnref<SkImageFilter> offsetForeground(SkOffsetImageFilter::Create(
- SkIntToScalar(4), SkIntToScalar(-4), foreground));
+ SkIntToScalar(4), SkIntToScalar(-4), foreground.get()));
SkAutoTUnref<SkImageFilter> offsetBackground(SkOffsetImageFilter::Create(
- SkIntToScalar(4), SkIntToScalar(4), background));
+ SkIntToScalar(4), SkIntToScalar(4), background.get()));
paint.setImageFilter(SkXfermodeImageFilter::Make(
SkXfermode::Make(SkXfermode::kSrcOver_Mode), offsetBackground,
offsetForeground, nullptr));
@@ -166,9 +166,10 @@ protected:
// Test small bg, large fg with Screen (uses shader blend)
auto mode = SkXfermode::Make(SkXfermode::kScreen_Mode);
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(10, 10, 60, 60));
- SkAutoTUnref<SkImageFilter> cropped(
- SkOffsetImageFilter::Create(0, 0, foreground, &cropRect));
- paint.setImageFilter(SkXfermodeImageFilter::Make(mode, cropped, background, nullptr));
+ sk_sp<SkImageFilter> cropped(
+ SkOffsetImageFilter::Create(0, 0, foreground.get(), &cropRect));
+ paint.setImageFilter(SkXfermodeImageFilter::Make(mode, cropped.get(),
+ background.get(), nullptr));
DrawClippedPaint(canvas, clipRect, paint, x, y);
x += fBitmap.width() + MARGIN;
if (x + fBitmap.width() > WIDTH) {
@@ -176,7 +177,8 @@ protected:
y += fBitmap.height() + MARGIN;
}
// Test small fg, large bg with Screen (uses shader blend)
- paint.setImageFilter(SkXfermodeImageFilter::Make(mode, background, cropped, nullptr));
+ paint.setImageFilter(SkXfermodeImageFilter::Make(mode, background.get(),
+ cropped.get(), nullptr));
DrawClippedPaint(canvas, clipRect, paint, x, y);
x += fBitmap.width() + MARGIN;
if (x + fBitmap.width() > WIDTH) {

Powered by Google App Engine
This is Rietveld 408576698