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

Unified Diff: gm/testimagefilters.cpp

Issue 1841233002: Update SkComposeImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review comments 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
« no previous file with comments | « no previous file | include/effects/SkComposeImageFilter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/testimagefilters.cpp
diff --git a/gm/testimagefilters.cpp b/gm/testimagefilters.cpp
index 465d606e2ba5315d72de6d2b1f5bb9cb89c0ac8b..2380b3438edd3ecec78fce5e80c0efbeafb4bc9e 100644
--- a/gm/testimagefilters.cpp
+++ b/gm/testimagefilters.cpp
@@ -21,59 +21,55 @@
#define FILTER_WIDTH SkIntToScalar(150)
#define FILTER_HEIGHT SkIntToScalar(200)
-static SkImageFilter* make0() { return SkDownSampleImageFilter::Create(SK_Scalar1 / 5); }
-static SkImageFilter* make1() { return SkOffsetImageFilter::Create(SkIntToScalar(16), SkIntToScalar(16)); }
+static SkImageFilter* make0() {
+ return SkDownSampleImageFilter::Create(SK_Scalar1 / 5);
+}
+
+static SkImageFilter* make1() {
+ return SkOffsetImageFilter::Create(SkIntToScalar(16), SkIntToScalar(16));
+}
+
static SkImageFilter* make2() {
- auto cf = SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode);
+ sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode));
return SkColorFilterImageFilter::Create(cf.get());
}
+
static SkImageFilter* make3() {
return SkBlurImageFilter::Create(8, 0);
}
static SkImageFilter* make4() {
- SkImageFilter* outer = SkOffsetImageFilter::Create(SkIntToScalar(16), SkIntToScalar(16));
- SkImageFilter* inner = SkDownSampleImageFilter::Create(SK_Scalar1 / 5);
- SkAutoUnref aur0(outer);
- SkAutoUnref aur1(inner);
- return SkComposeImageFilter::Create(outer, inner);
+ sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Create(SkIntToScalar(16), SkIntToScalar(16)));
+ sk_sp<SkImageFilter> inner(SkDownSampleImageFilter::Create(SK_Scalar1 / 5));
+ return SkComposeImageFilter::Make(std::move(outer), std::move(inner)).release();
}
+
static SkImageFilter* make5() {
- SkImageFilter* first = SkOffsetImageFilter::Create(SkIntToScalar(16), SkIntToScalar(16));
- SkImageFilter* second = SkDownSampleImageFilter::Create(SK_Scalar1 / 5);
- SkAutoUnref aur0(first);
- SkAutoUnref aur1(second);
- return SkMergeImageFilter::Create(first, second);
+ 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());
}
static SkImageFilter* make6() {
- SkImageFilter* outer = SkOffsetImageFilter::Create(SkIntToScalar(16), SkIntToScalar(16));
- SkImageFilter* inner = SkDownSampleImageFilter::Create(SK_Scalar1 / 5);
- SkAutoUnref aur0(outer);
- SkAutoUnref aur1(inner);
- SkImageFilter* compose = SkComposeImageFilter::Create(outer, inner);
- SkAutoUnref aur2(compose);
-
- auto cf = SkColorFilter::MakeModeFilter(0x880000FF, SkXfermode::kSrcIn_Mode);
- SkImageFilter* blue = SkColorFilterImageFilter::Create(cf.get());
- SkAutoUnref aur4(blue);
-
- return SkMergeImageFilter::Create(compose, blue);
+ sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Create(SkIntToScalar(16), SkIntToScalar(16)));
+ sk_sp<SkImageFilter> inner(SkDownSampleImageFilter::Create(SK_Scalar1 / 5));
+ sk_sp<SkImageFilter> compose(SkComposeImageFilter::Make(std::move(outer), std::move(inner)));
+
+ 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());
}
static SkImageFilter* make7() {
- SkImageFilter* outer = SkOffsetImageFilter::Create(SkIntToScalar(16), SkIntToScalar(16));
- SkImageFilter* inner = make3();
- SkAutoUnref aur0(outer);
- SkAutoUnref aur1(inner);
- SkImageFilter* compose = SkComposeImageFilter::Create(outer, inner);
- SkAutoUnref aur2(compose);
-
- auto cf = SkColorFilter::MakeModeFilter(0x880000FF, SkXfermode::kSrcIn_Mode);
- SkImageFilter* blue = SkColorFilterImageFilter::Create(cf.get());
- SkAutoUnref aur4(blue);
-
- return SkMergeImageFilter::Create(compose, blue);
+ sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Create(SkIntToScalar(16), SkIntToScalar(16)));
+ sk_sp<SkImageFilter> inner(make3());
+ sk_sp<SkImageFilter> compose(SkComposeImageFilter::Make(std::move(outer), std::move(inner)));
+
+ 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());
}
static void draw0(SkCanvas* canvas) {
« no previous file with comments | « no previous file | include/effects/SkComposeImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698