aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-04-15 07:17:36 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-15 07:17:36 -0700
commitbfe11fc9a6e660f83a454b6a5f5945089a4800f3 (patch)
treea3210a33732d4cce0c600e9481bfe5d03999edd4 /gm
parent8c3fd4f1b49a77634b73f787c6c49d34039a16f0 (diff)
Update DisplacementMapEffect to sk_sp
Diffstat (limited to 'gm')
-rw-r--r--gm/displacement.cpp154
-rw-r--r--gm/imagefiltersclipped.cpp11
-rw-r--r--gm/imagefilterscropexpand.cpp13
-rw-r--r--gm/imagefiltersscaled.cpp11
-rw-r--r--gm/imagefilterstransformed.cpp11
5 files changed, 98 insertions, 102 deletions
diff --git a/gm/displacement.cpp b/gm/displacement.cpp
index 9b62a60ab3..9fea0188df 100644
--- a/gm/displacement.cpp
+++ b/gm/displacement.cpp
@@ -58,142 +58,142 @@ protected:
canvas->clear(SK_ColorBLACK);
SkPaint paint;
sk_sp<SkImageFilter> displ(SkImageSource::Make(fCheckerboard));
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkDisplacementMapEffect::kG_ChannelSelectorType, 0.0f, displ.get()))->unref();
- drawClippedBitmap(canvas, 0, 0, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ SkDisplacementMapEffect::kG_ChannelSelectorType, 0.0f, displ, nullptr));
+ this->drawClippedBitmap(canvas, 0, 0, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kB_ChannelSelectorType,
- SkDisplacementMapEffect::kA_ChannelSelectorType, 16.0f, displ.get()))->unref();
- drawClippedBitmap(canvas, 100, 0, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ SkDisplacementMapEffect::kA_ChannelSelectorType, 16.0f, displ, nullptr));
+ this->drawClippedBitmap(canvas, 100, 0, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkDisplacementMapEffect::kB_ChannelSelectorType, 32.0f, displ.get()))->unref();
- drawClippedBitmap(canvas, 200, 0, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ SkDisplacementMapEffect::kB_ChannelSelectorType, 32.0f, displ, nullptr));
+ this->drawClippedBitmap(canvas, 200, 0, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kG_ChannelSelectorType,
- SkDisplacementMapEffect::kA_ChannelSelectorType, 48.0f, displ.get()))->unref();
- drawClippedBitmap(canvas, 300, 0, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ SkDisplacementMapEffect::kA_ChannelSelectorType, 48.0f, displ, nullptr));
+ this->drawClippedBitmap(canvas, 300, 0, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkDisplacementMapEffect::kA_ChannelSelectorType, 64.0f, displ.get()))->unref();
- drawClippedBitmap(canvas, 400, 0, paint);
+ SkDisplacementMapEffect::kA_ChannelSelectorType, 64.0f, displ, nullptr));
+ this->drawClippedBitmap(canvas, 400, 0, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkDisplacementMapEffect::kG_ChannelSelectorType, 40.0f, displ.get()))->unref();
- drawClippedBitmap(canvas, 0, 100, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ SkDisplacementMapEffect::kG_ChannelSelectorType, 40.0f, displ, nullptr));
+ this->drawClippedBitmap(canvas, 0, 100, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kB_ChannelSelectorType,
- SkDisplacementMapEffect::kA_ChannelSelectorType, 40.0f, displ.get()))->unref();
- drawClippedBitmap(canvas, 100, 100, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ SkDisplacementMapEffect::kA_ChannelSelectorType, 40.0f, displ, nullptr));
+ this->drawClippedBitmap(canvas, 100, 100, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkDisplacementMapEffect::kB_ChannelSelectorType, 40.0f, displ.get()))->unref();
- drawClippedBitmap(canvas, 200, 100, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ SkDisplacementMapEffect::kB_ChannelSelectorType, 40.0f, displ, nullptr));
+ this->drawClippedBitmap(canvas, 200, 100, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kG_ChannelSelectorType,
- SkDisplacementMapEffect::kA_ChannelSelectorType, 40.0f, displ.get()))->unref();
- drawClippedBitmap(canvas, 300, 100, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ SkDisplacementMapEffect::kA_ChannelSelectorType, 40.0f, displ, nullptr));
+ this->drawClippedBitmap(canvas, 300, 100, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkDisplacementMapEffect::kA_ChannelSelectorType, 40.0f, displ.get()))->unref();
- drawClippedBitmap(canvas, 400, 100, paint);
+ SkDisplacementMapEffect::kA_ChannelSelectorType, 40.0f, displ, nullptr));
+ this->drawClippedBitmap(canvas, 400, 100, paint);
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(30, 30, 40, 40));
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kG_ChannelSelectorType,
- 0.0f, displ.get(), nullptr, &cropRect))->unref();
- drawClippedBitmap(canvas, 0, 200, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ 0.0f, displ, nullptr, &cropRect));
+ this->drawClippedBitmap(canvas, 0, 200, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kB_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 16.0f, displ.get(), nullptr, &cropRect))->unref();
- drawClippedBitmap(canvas, 100, 200, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ 16.0f, displ, nullptr, &cropRect));
+ this->drawClippedBitmap(canvas, 100, 200, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kB_ChannelSelectorType,
- 32.0f, displ.get(), nullptr, &cropRect))->unref();
- drawClippedBitmap(canvas, 200, 200, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ 32.0f, displ, nullptr, &cropRect));
+ this->drawClippedBitmap(canvas, 200, 200, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kG_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 48.0f, displ.get(), nullptr, &cropRect))->unref();
- drawClippedBitmap(canvas, 300, 200, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ 48.0f, displ, nullptr, &cropRect));
+ this->drawClippedBitmap(canvas, 300, 200, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 64.0f, displ.get(), nullptr, &cropRect))->unref();
- drawClippedBitmap(canvas, 400, 200, paint);
+ 64.0f, displ, nullptr, &cropRect));
+ this->drawClippedBitmap(canvas, 400, 200, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kG_ChannelSelectorType,
- 40.0f, displ.get(), nullptr, &cropRect))->unref();
- drawClippedBitmap(canvas, 0, 300, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ 40.0f, displ, nullptr, &cropRect));
+ this->drawClippedBitmap(canvas, 0, 300, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kB_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 40.0f, displ.get(), nullptr, &cropRect))->unref();
- drawClippedBitmap(canvas, 100, 300, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ 40.0f, displ, nullptr, &cropRect));
+ this->drawClippedBitmap(canvas, 100, 300, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kB_ChannelSelectorType,
- 40.0f, displ.get(), nullptr, &cropRect))->unref();
- drawClippedBitmap(canvas, 200, 300, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ 40.0f, displ, nullptr, &cropRect));
+ this->drawClippedBitmap(canvas, 200, 300, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kG_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 40.0f, displ.get(), nullptr, &cropRect))->unref();
- drawClippedBitmap(canvas, 300, 300, paint);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ 40.0f, displ, nullptr, &cropRect));
+ this->drawClippedBitmap(canvas, 300, 300, paint);
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 40.0f, displ.get(), nullptr, &cropRect))->unref();
- drawClippedBitmap(canvas, 400, 300, paint);
+ 40.0f, displ, nullptr, &cropRect));
+ this->drawClippedBitmap(canvas, 400, 300, paint);
// Test for negative scale.
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kG_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- -40.0f, displ.get()))->unref();
+ -40.0f, displ, nullptr));
this->drawClippedBitmap(canvas, 500, 0, paint);
// Tests for images of different sizes
displ = SkImageSource::Make(fSmall);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kG_ChannelSelectorType,
- 40.0f, displ.get()))->unref();
- drawClippedBitmap(canvas, 0, 400, paint);
+ 40.0f, std::move(displ), nullptr));
+ this->drawClippedBitmap(canvas, 0, 400, paint);
displ = SkImageSource::Make(fLarge);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kB_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 40.0f, displ.get()))->unref();
- drawClippedBitmap(canvas, 100, 400, paint);
+ 40.0f, std::move(displ), nullptr));
+ this->drawClippedBitmap(canvas, 100, 400, paint);
displ = SkImageSource::Make(fLargeW);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kB_ChannelSelectorType,
- 40.0f, displ.get()))->unref();
- drawClippedBitmap(canvas, 200, 400, paint);
+ 40.0f, std::move(displ), nullptr));
+ this->drawClippedBitmap(canvas, 200, 400, paint);
displ = SkImageSource::Make(fLargeH);
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kG_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 40.0f, displ.get()))->unref();
- drawClippedBitmap(canvas, 300, 400, paint);
+ 40.0f, std::move(displ), nullptr));
+ this->drawClippedBitmap(canvas, 300, 400, paint);
// Test for no given displacement input. In this case, both displacement
// and color should use the same bitmap, given to SkCanvas::drawBitmap()
// as an input argument.
- paint.setImageFilter(SkDisplacementMapEffect::Create(
+ paint.setImageFilter(SkDisplacementMapEffect::Make(
SkDisplacementMapEffect::kG_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 40.0f, nullptr))->unref();
- drawClippedBitmap(canvas, 400, 400, paint);
+ 40.0f, nullptr, nullptr));
+ this->drawClippedBitmap(canvas, 400, 400, paint);
}
private:
diff --git a/gm/imagefiltersclipped.cpp b/gm/imagefiltersclipped.cpp
index f2434112fa..7989f8b4b0 100644
--- a/gm/imagefiltersclipped.cpp
+++ b/gm/imagefiltersclipped.cpp
@@ -100,12 +100,11 @@ protected:
SkIntToScalar(3), SkIntToScalar(3), SK_ColorGREEN,
SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode,
nullptr),
- sk_sp<SkImageFilter>(SkDisplacementMapEffect::Create(
- SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkIntToScalar(12),
- gradient.get(),
- checkerboard.get())),
+ SkDisplacementMapEffect::Make(SkDisplacementMapEffect::kR_ChannelSelectorType,
+ SkDisplacementMapEffect::kR_ChannelSelectorType,
+ SkIntToScalar(12),
+ std::move(gradient),
+ checkerboard),
SkDilateImageFilter::Make(2, 2, checkerboard),
SkErodeImageFilter::Make(2, 2, checkerboard),
SkOffsetImageFilter::Make(SkIntToScalar(-16), SkIntToScalar(32), nullptr),
diff --git a/gm/imagefilterscropexpand.cpp b/gm/imagefilterscropexpand.cpp
index 3d5fcf3612..4ce845d9ee 100644
--- a/gm/imagefilterscropexpand.cpp
+++ b/gm/imagefilterscropexpand.cpp
@@ -107,13 +107,12 @@ protected:
&bigRect));
Draw(canvas, checkerboard, rect,
- sk_sp<SkImageFilter>(SkDisplacementMapEffect::Create(
- SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkIntToScalar(12),
- gradientCircleSource.get(),
- noopCropped.get(),
- &bigRect)));
+ SkDisplacementMapEffect::Make(SkDisplacementMapEffect::kR_ChannelSelectorType,
+ SkDisplacementMapEffect::kR_ChannelSelectorType,
+ SkIntToScalar(12),
+ gradientCircleSource,
+ noopCropped,
+ &bigRect));
Draw(canvas, checkerboard, rect,
SkOffsetImageFilter::Make(SkIntToScalar(-8), SkIntToScalar(16),
diff --git a/gm/imagefiltersscaled.cpp b/gm/imagefiltersscaled.cpp
index 4c48aec869..756b7c624c 100644
--- a/gm/imagefiltersscaled.cpp
+++ b/gm/imagefiltersscaled.cpp
@@ -98,12 +98,11 @@ protected:
SkIntToScalar(3), SkIntToScalar(3), SK_ColorYELLOW,
SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode,
nullptr),
- sk_sp<SkImageFilter>(SkDisplacementMapEffect::Create(
- SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkIntToScalar(12),
- gradient.get(),
- checkerboard.get())),
+ SkDisplacementMapEffect::Make(SkDisplacementMapEffect::kR_ChannelSelectorType,
+ SkDisplacementMapEffect::kR_ChannelSelectorType,
+ SkIntToScalar(12),
+ std::move(gradient),
+ checkerboard),
SkDilateImageFilter::Make(1, 1, checkerboard),
SkErodeImageFilter::Make(1, 1, checkerboard),
SkOffsetImageFilter::Make(SkIntToScalar(32), 0, nullptr),
diff --git a/gm/imagefilterstransformed.cpp b/gm/imagefilterstransformed.cpp
index 291d1d46ec..ce7ba5d6e0 100644
--- a/gm/imagefilterstransformed.cpp
+++ b/gm/imagefilterstransformed.cpp
@@ -69,12 +69,11 @@ protected:
SkBlurImageFilter::Make(12, 0, nullptr),
SkDropShadowImageFilter::Make(0, 15, 8, 0, SK_ColorGREEN,
SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, nullptr),
- sk_sp<SkImageFilter>(SkDisplacementMapEffect::Create(
- SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkDisplacementMapEffect::kR_ChannelSelectorType,
- 12,
- gradient.get(),
- checkerboard.get())),
+ SkDisplacementMapEffect::Make(SkDisplacementMapEffect::kR_ChannelSelectorType,
+ SkDisplacementMapEffect::kR_ChannelSelectorType,
+ 12,
+ std::move(gradient),
+ checkerboard),
SkDilateImageFilter::Make(2, 2, checkerboard),
SkErodeImageFilter::Make(2, 2, checkerboard),
};