diff options
author | robertphillips <robertphillips@google.com> | 2016-03-30 13:34:16 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-30 13:34:17 -0700 |
commit | 2238c9dbca4b791edc512957728a18ce14d55912 (patch) | |
tree | 684102215b697506f7c2dce012bb89183467e208 /gm | |
parent | 3243143f25f4ccba632847574cf8e1a8ee0fe0f2 (diff) |
Update SkMergeImageFilter to sk_sp
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1847583002
Review URL: https://codereview.chromium.org/1847583002
Diffstat (limited to 'gm')
-rw-r--r-- | gm/imagefiltersbase.cpp | 2 | ||||
-rw-r--r-- | gm/imagefilterscropped.cpp | 5 | ||||
-rw-r--r-- | gm/imagefiltersgraph.cpp | 17 | ||||
-rw-r--r-- | gm/testimagefilters.cpp | 6 |
4 files changed, 16 insertions, 14 deletions
diff --git a/gm/imagefiltersbase.cpp b/gm/imagefiltersbase.cpp index d580243453..4a5f5e5977 100644 --- a/gm/imagefiltersbase.cpp +++ b/gm/imagefiltersbase.cpp @@ -91,7 +91,7 @@ static IdentityImageFilter::Registrar gReg1; SkFlattenable* IdentityImageFilter::CreateProc(SkReadBuffer& buffer) { SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); - return IdentityImageFilter::Create(common.getInput(0)); + return IdentityImageFilter::Create(common.getInput(0).get()); } #ifndef SK_IGNORE_TO_STRING diff --git a/gm/imagefilterscropped.cpp b/gm/imagefilterscropped.cpp index b06761d80c..612990984a 100644 --- a/gm/imagefilterscropped.cpp +++ b/gm/imagefilterscropped.cpp @@ -122,7 +122,7 @@ protected: SkAutoTUnref<SkImageFilter> offset(SkOffsetImageFilter::Create( SkIntToScalar(-10), SkIntToScalar(-10))); - SkAutoTUnref<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf.get(), offset.get())); + sk_sp<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf.get(), offset.get())); SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, nullptr, &cropRect)); SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, nullptr, &cropRect)); @@ -139,7 +139,8 @@ protected: SkErodeImageFilter::Create(8, 0, erodeY, &cropRect), SkErodeImageFilter::Create(0, 8, erodeX, &cropRect), SkErodeImageFilter::Create(8, 8, nullptr, &cropRect), - SkMergeImageFilter::Create(nullptr, cfOffset.get(), SkXfermode::kSrcOver_Mode, &cropRect), + SkMergeImageFilter::Make(nullptr, std::move(cfOffset), + SkXfermode::kSrcOver_Mode, &cropRect).release(), SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &bogusRect), SkColorFilterImageFilter::Create(cf.get(), nullptr, &bogusRect), }; diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp index 53343bc3d0..e7abdcfc0f 100644 --- a/gm/imagefiltersgraph.cpp +++ b/gm/imagefiltersgraph.cpp @@ -88,7 +88,7 @@ SkFlattenable* SimpleOffsetFilter::CreateProc(SkReadBuffer& buffer) { SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); SkScalar dx = buffer.readScalar(); SkScalar dy = buffer.readScalar(); - return Create(dx, dy, common.getInput(0)); + return Create(dx, dy, common.getInput(0).get()); } #ifndef SK_IGNORE_TO_STRING @@ -118,15 +118,16 @@ protected: void onDraw(SkCanvas* canvas) override { canvas->clear(SK_ColorBLACK); { - SkAutoTUnref<SkImageFilter> bitmapSource(SkImageSource::Create(fImage.get())); - auto cf(SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode)); - SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create(4.0f, 4.0f, bitmapSource)); - SkAutoTUnref<SkImageFilter> erode(SkErodeImageFilter::Create(4, 4, blur)); - SkAutoTUnref<SkImageFilter> color(SkColorFilterImageFilter::Create(cf.get(), erode)); - SkAutoTUnref<SkImageFilter> merge(SkMergeImageFilter::Create(blur, color)); + sk_sp<SkImageFilter> bitmapSource(SkImageSource::Create(fImage.get())); + sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(SK_ColorRED, + SkXfermode::kSrcIn_Mode)); + sk_sp<SkImageFilter> blur(SkBlurImageFilter::Create(4.0f, 4.0f, bitmapSource.get())); + sk_sp<SkImageFilter> erode(SkErodeImageFilter::Create(4, 4, blur.get())); + sk_sp<SkImageFilter> color(SkColorFilterImageFilter::Create(cf.get(), erode.get())); + sk_sp<SkImageFilter> merge(SkMergeImageFilter::Make(blur, color)); SkPaint paint; - paint.setImageFilter(merge); + paint.setImageFilter(std::move(merge)); canvas->drawPaint(paint); canvas->translate(SkIntToScalar(100), 0); } diff --git a/gm/testimagefilters.cpp b/gm/testimagefilters.cpp index 2380b3438e..c4bddbf4e8 100644 --- a/gm/testimagefilters.cpp +++ b/gm/testimagefilters.cpp @@ -47,7 +47,7 @@ static SkImageFilter* make4() { static SkImageFilter* make5() { sk_sp<SkImageFilter> first(SkOffsetImageFilter::Create(SkIntToScalar(16), SkIntToScalar(16))); sk_sp<SkImageFilter> second(SkDownSampleImageFilter::Create(SK_Scalar1 / 5)); - return SkMergeImageFilter::Create(first.get(), second.get()); + return SkMergeImageFilter::Make(std::move(first), std::move(second)).release(); } static SkImageFilter* make6() { @@ -58,7 +58,7 @@ static SkImageFilter* make6() { sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(0x880000FF, SkXfermode::kSrcIn_Mode)); sk_sp<SkImageFilter> blue(SkColorFilterImageFilter::Create(cf.get())); - return SkMergeImageFilter::Create(compose.get(), blue.get()); + return SkMergeImageFilter::Make(std::move(compose), std::move(blue)).release(); } static SkImageFilter* make7() { @@ -69,7 +69,7 @@ static SkImageFilter* make7() { sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(0x880000FF, SkXfermode::kSrcIn_Mode)); sk_sp<SkImageFilter> blue(SkColorFilterImageFilter::Create(cf.get())); - return SkMergeImageFilter::Create(compose.get(), blue.get()); + return SkMergeImageFilter::Make(std::move(compose), std::move(blue)).release(); } static void draw0(SkCanvas* canvas) { |