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/imagefiltersbase.cpp

Issue 1854023003: Update internal testing ImageFilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 8 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 | gm/imagefiltersgraph.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imagefiltersbase.cpp
diff --git a/gm/imagefiltersbase.cpp b/gm/imagefiltersbase.cpp
index d2367e285aca71274e96e60dc4c4716a8102dfba..be4325ef1fffa2ca65c0ebbdcd2ebfacf513296b 100644
--- a/gm/imagefiltersbase.cpp
+++ b/gm/imagefiltersbase.cpp
@@ -26,13 +26,15 @@ public:
FailImageFilter::GetFlattenableType());
}
};
- static FailImageFilter* Create() { return new FailImageFilter; }
+ static sk_sp<SkImageFilter> Make() {
+ return sk_sp<SkImageFilter>(new FailImageFilter);
+ }
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter)
protected:
- FailImageFilter() : INHERITED(0, nullptr) {}
+ FailImageFilter() : INHERITED(nullptr, 0, nullptr) {}
bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Context&,
SkBitmap* result, SkIPoint* offset) const override {
@@ -47,7 +49,7 @@ static FailImageFilter::Registrar gReg0;
sk_sp<SkFlattenable> FailImageFilter::CreateProc(SkReadBuffer& buffer) {
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0);
- return sk_sp<SkFlattenable>(FailImageFilter::Create());
+ return FailImageFilter::Make();
}
#ifndef SK_IGNORE_TO_STRING
@@ -67,15 +69,14 @@ public:
IdentityImageFilter::GetFlattenableType());
}
};
- static IdentityImageFilter* Create(SkImageFilter* input = nullptr) {
- return new IdentityImageFilter(input);
+ static sk_sp<SkImageFilter> Make(sk_sp<SkImageFilter> input) {
+ return sk_sp<SkImageFilter>(new IdentityImageFilter(std::move(input)));
}
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter)
-protected:
- IdentityImageFilter(SkImageFilter* input) : INHERITED(1, &input) {}
+protected:
bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Context&,
SkBitmap* result, SkIPoint* offset) const override {
*result = src;
@@ -84,6 +85,8 @@ protected:
}
private:
+ IdentityImageFilter(sk_sp<SkImageFilter> input) : INHERITED(&input, 1, nullptr) {}
+
typedef SkImageFilter INHERITED;
};
@@ -91,7 +94,7 @@ static IdentityImageFilter::Registrar gReg1;
sk_sp<SkFlattenable> IdentityImageFilter::CreateProc(SkReadBuffer& buffer) {
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
- return sk_sp<SkFlattenable>(IdentityImageFilter::Create(common.getInput(0).get()));
+ return IdentityImageFilter::Make(common.getInput(0));
}
#ifndef SK_IGNORE_TO_STRING
@@ -195,8 +198,8 @@ protected:
auto cf = SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode);
SkImageFilter* filters[] = {
nullptr,
- IdentityImageFilter::Create(),
- FailImageFilter::Create(),
+ IdentityImageFilter::Make(nullptr).release(),
+ FailImageFilter::Make().release(),
SkColorFilterImageFilter::Create(cf.get()),
SkBlurImageFilter::Make(12.0f, 0.0f, nullptr).release(),
SkDropShadowImageFilter::Create(10.0f, 5.0f, 3.0f, 3.0f, SK_ColorBLUE,
« no previous file with comments | « no previous file | gm/imagefiltersgraph.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698