aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-04-05 12:48:34 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-05 12:48:34 -0700
commit8c0326df5f600da43a054dad3b354221dd6b790f (patch)
tree0d005e6ffab3ae81137bf0ee9c453b8377b886c9 /gm
parentd32eac278e94ef92f6edd8c541fb57892b7b62ff (diff)
Update SkXfermodeImageFilter to sk_sp
Diffstat (limited to 'gm')
-rw-r--r--gm/imagefiltersgraph.cpp9
-rw-r--r--gm/xfermodeimagefilter.cpp29
2 files changed, 20 insertions, 18 deletions
diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp
index 319884b026..8bf3930fec 100644
--- a/gm/imagefiltersgraph.cpp
+++ b/gm/imagefiltersgraph.cpp
@@ -160,7 +160,7 @@ protected:
SkPaint paint;
paint.setImageFilter(SkXfermodeImageFilter::Make(
SkXfermode::Make(SkXfermode::kSrcOver_Mode),
- colorMorph.get()));
+ std::move(colorMorph)));
DrawClippedImage(canvas, fImage.get(), paint);
canvas->translate(SkIntToScalar(100), 0);
@@ -178,7 +178,9 @@ protected:
SkPaint paint;
paint.setImageFilter(
SkXfermodeImageFilter::Make(SkArithmeticMode::Make(0, SK_Scalar1, SK_Scalar1, 0),
- matrixFilter.get(), offsetFilter.get(), nullptr));
+ std::move(matrixFilter),
+ std::move(offsetFilter),
+ nullptr));
DrawClippedImage(canvas, fImage.get(), paint);
canvas->translate(SkIntToScalar(100), 0);
@@ -191,7 +193,8 @@ protected:
SkImageFilter::CropRect cropRect(SkRect::MakeWH(SkIntToScalar(95), SkIntToScalar(100)));
SkPaint paint;
paint.setImageFilter(
- SkXfermodeImageFilter::Make(SkXfermode::Make(SkXfermode::kSrcIn_Mode), blur.get(),
+ SkXfermodeImageFilter::Make(SkXfermode::Make(SkXfermode::kSrcIn_Mode),
+ std::move(blur),
nullptr, &cropRect));
DrawClippedImage(canvas, fImage.get(), paint);
canvas->translate(SkIntToScalar(100), 0);
diff --git a/gm/xfermodeimagefilter.cpp b/gm/xfermodeimagefilter.cpp
index 3293c81ba4..ee6822a3f4 100644
--- a/gm/xfermodeimagefilter.cpp
+++ b/gm/xfermodeimagefilter.cpp
@@ -88,7 +88,7 @@ protected:
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.get()));
+ background));
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.get()));
+ SkArithmeticMode::Make(0, SK_Scalar1, SK_Scalar1, 0),
+ background));
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.get()));
+ paint.setImageFilter(SkXfermodeImageFilter::Make(nullptr, background));
DrawClippedBitmap(canvas, fBitmap, paint, x, y);
x += fBitmap.width() + MARGIN;
if (x + fBitmap.width() > WIDTH) {
@@ -126,8 +127,8 @@ protected:
background));
paint.setImageFilter(SkXfermodeImageFilter::Make(
SkXfermode::Make(SkXfermode::kSrcOver_Mode),
- offsetBackground.get(),
- offsetForeground.get(),
+ offsetBackground,
+ offsetForeground,
nullptr));
DrawClippedPaint(canvas, clipRect, paint, x, y);
x += fBitmap.width() + MARGIN;
@@ -137,8 +138,8 @@ protected:
}
// Test offsets on Darken (uses shader blend)
paint.setImageFilter(SkXfermodeImageFilter::Make(SkXfermode::Make(SkXfermode::kDarken_Mode),
- offsetBackground.get(),
- offsetForeground.get(),
+ offsetBackground,
+ offsetForeground,
nullptr));
DrawClippedPaint(canvas, clipRect, paint, x, y);
x += fBitmap.width() + MARGIN;
@@ -161,8 +162,8 @@ protected:
fBitmap.height() + offsets[i][3]);
SkImageFilter::CropRect rect(SkRect::Make(cropRect));
paint.setImageFilter(SkXfermodeImageFilter::Make(SkXfermode::Make(sampledModes[i]),
- offsetBackground.get(),
- offsetForeground.get(),
+ offsetBackground,
+ offsetForeground,
&rect));
DrawClippedPaint(canvas, clipRect, paint, x, y);
x += fBitmap.width() + MARGIN;
@@ -175,8 +176,7 @@ protected:
auto mode = SkXfermode::Make(SkXfermode::kScreen_Mode);
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(10, 10, 60, 60));
sk_sp<SkImageFilter> cropped(SkOffsetImageFilter::Make(0, 0, foreground, &cropRect));
- paint.setImageFilter(SkXfermodeImageFilter::Make(mode, cropped.get(),
- background.get(), nullptr));
+ paint.setImageFilter(SkXfermodeImageFilter::Make(mode, cropped, background, nullptr));
DrawClippedPaint(canvas, clipRect, paint, x, y);
x += fBitmap.width() + MARGIN;
if (x + fBitmap.width() > WIDTH) {
@@ -184,8 +184,7 @@ protected:
y += fBitmap.height() + MARGIN;
}
// Test small fg, large bg with Screen (uses shader blend)
- paint.setImageFilter(SkXfermodeImageFilter::Make(mode, background.get(),
- cropped.get(), nullptr));
+ paint.setImageFilter(SkXfermodeImageFilter::Make(mode, background, cropped, nullptr));
DrawClippedPaint(canvas, clipRect, paint, x, y);
x += fBitmap.width() + MARGIN;
if (x + fBitmap.width() > WIDTH) {
@@ -197,8 +196,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.get(),
- cropped.get(), &cropRectFull));
+ paint.setImageFilter(SkXfermodeImageFilter::Make(mode, background,
+ cropped, &cropRectFull));
DrawClippedPaint(canvas, clipRect, paint, x, y);
x += fBitmap.width() + MARGIN;
if (x + fBitmap.width() > WIDTH) {