Index: gm/xfermodeimagefilter.cpp |
diff --git a/gm/xfermodeimagefilter.cpp b/gm/xfermodeimagefilter.cpp |
index 5603c784560f22686dcd4d43e597dc795f307342..dc8cbede2167b5462b5c0d60029ee74065540545 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::Create(fCheckerboard.get())); |
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,8 @@ 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 +107,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,14 +118,18 @@ 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())); |
- SkAutoTUnref<SkImageFilter> offsetForeground(SkOffsetImageFilter::Create( |
- SkIntToScalar(4), SkIntToScalar(-4), foreground)); |
- SkAutoTUnref<SkImageFilter> offsetBackground(SkOffsetImageFilter::Create( |
- SkIntToScalar(4), SkIntToScalar(4), background)); |
+ sk_sp<SkImageFilter> foreground(SkImageSource::Create(bitmapImage.get())); |
+ sk_sp<SkImageFilter> offsetForeground(SkOffsetImageFilter::Make(SkIntToScalar(4), |
+ SkIntToScalar(-4), |
+ foreground)); |
+ sk_sp<SkImageFilter> offsetBackground(SkOffsetImageFilter::Make(SkIntToScalar(4), |
+ SkIntToScalar(4), |
+ background)); |
paint.setImageFilter(SkXfermodeImageFilter::Make( |
- SkXfermode::Make(SkXfermode::kSrcOver_Mode), offsetBackground, |
- offsetForeground, nullptr)); |
+ SkXfermode::Make(SkXfermode::kSrcOver_Mode), |
+ offsetBackground.get(), |
+ offsetForeground.get(), |
+ nullptr)); |
DrawClippedPaint(canvas, clipRect, paint, x, y); |
x += fBitmap.width() + MARGIN; |
if (x + fBitmap.width() > WIDTH) { |
@@ -133,7 +138,9 @@ protected: |
} |
// Test offsets on Darken (uses shader blend) |
paint.setImageFilter(SkXfermodeImageFilter::Make(SkXfermode::Make(SkXfermode::kDarken_Mode), |
- offsetBackground, offsetForeground, nullptr)); |
+ offsetBackground.get(), |
+ offsetForeground.get(), |
+ nullptr)); |
DrawClippedPaint(canvas, clipRect, paint, x, y); |
x += fBitmap.width() + MARGIN; |
if (x + fBitmap.width() > WIDTH) { |
@@ -154,8 +161,10 @@ protected: |
fBitmap.width() + offsets[i][2], |
fBitmap.height() + offsets[i][3]); |
SkImageFilter::CropRect rect(SkRect::Make(cropRect)); |
- paint.setImageFilter(SkXfermodeImageFilter::Make( |
- SkXfermode::Make(sampledModes[i]), offsetBackground, offsetForeground, &rect)); |
+ paint.setImageFilter(SkXfermodeImageFilter::Make(SkXfermode::Make(sampledModes[i]), |
+ offsetBackground.get(), |
+ offsetForeground.get(), |
+ &rect)); |
DrawClippedPaint(canvas, clipRect, paint, x, y); |
x += fBitmap.width() + MARGIN; |
if (x + fBitmap.width() > WIDTH) { |
@@ -166,9 +175,9 @@ 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::Make(0, 0, foreground, &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 +185,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) { |
@@ -188,7 +198,8 @@ protected: |
// the region outside the foreground. |
mode = SkXfermode::Make(SkXfermode::kSrcIn_Mode); |
SkImageFilter::CropRect cropRectFull(SkRect::MakeXYWH(0, 0, 80, 80)); |
- paint.setImageFilter(SkXfermodeImageFilter::Make(mode, background, cropped, &cropRectFull)); |
+ paint.setImageFilter(SkXfermodeImageFilter::Make(mode, background.get(), |
+ cropped.get(), &cropRectFull)); |
DrawClippedPaint(canvas, clipRect, paint, x, y); |
x += fBitmap.width() + MARGIN; |
if (x + fBitmap.width() > WIDTH) { |