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

Unified Diff: gm/imagefiltersbase.cpp

Issue 182983003: Factory methods for heap-allocated SkImageFilter objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 6 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 | « gm/imageblurtiled.cpp ('k') | gm/imagefiltersclipped.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 4794b02699c30ed650a13da82e22b2be5ed14bb4..86a7f81b47ab86fa9ec1bb9ee0ad877b527fae0f 100644
--- a/gm/imagefiltersbase.cpp
+++ b/gm/imagefiltersbase.cpp
@@ -18,10 +18,13 @@
class FailImageFilter : public SkImageFilter {
public:
- FailImageFilter() : INHERITED(0) {}
+ static FailImageFilter* Create() {
+ return SkNEW(FailImageFilter);
+ }
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter)
protected:
+ FailImageFilter() : INHERITED(0) {}
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) const {
return false;
@@ -41,10 +44,13 @@ static SkFlattenable::Registrar gFailImageFilterReg("FailImageFilter",
class IdentityImageFilter : public SkImageFilter {
public:
- IdentityImageFilter() : INHERITED(0) {}
+ static IdentityImageFilter* Create() {
+ return SkNEW(IdentityImageFilter);
+ }
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter)
protected:
+ IdentityImageFilter() : INHERITED(0) {}
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) const {
*result = src;
@@ -188,11 +194,11 @@ protected:
SkXfermode::kSrcIn_Mode);
SkImageFilter* filters[] = {
NULL,
- new IdentityImageFilter,
- new FailImageFilter,
+ IdentityImageFilter::Create(),
+ FailImageFilter::Create(),
SkColorFilterImageFilter::Create(cf),
- new SkBlurImageFilter(12.0f, 0.0f),
- new SkDropShadowImageFilter(10.0f, 5.0f, 3.0f, SK_ColorBLUE),
+ SkBlurImageFilter::Create(12.0f, 0.0f),
+ SkDropShadowImageFilter::Create(10.0f, 5.0f, 3.0f, SK_ColorBLUE),
};
cf->unref();
« no previous file with comments | « gm/imageblurtiled.cpp ('k') | gm/imagefiltersclipped.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698