From 9ea3d57fde28a5fe4487a111dc3dd49418235e5e Mon Sep 17 00:00:00 2001 From: senorblanco Date: Tue, 8 Jul 2014 09:16:22 -0700 Subject: Clean up SkImageFilter constructors. Now that all creation of SkImageFilters goes through factory Create() methods, there's no real reason for the convenience constructors. Some SkImageFilter subclasses which actually have zero DAG-able inputs were passing NULL to the superclass constructor. This actually means 1 input, with a NULL value, not zero inputs. This becomes more relevant for the upcoming cache infrastructure, where this indicates that the filter will use its src input, where in fact some of these filters do not (they are image generators only). Limiting SkImageFilter to a single constructor resolves this ambiguity. Along the way, I removed all of the default parameters to the constructors, since the Create methods always call them with the full argument list. BUG=skia: R=reed@google.com Author: senorblanco@chromium.org Review URL: https://codereview.chromium.org/376953003 --- gm/imagefiltersbase.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gm/imagefiltersbase.cpp') diff --git a/gm/imagefiltersbase.cpp b/gm/imagefiltersbase.cpp index 4779c81438..0760fcda76 100644 --- a/gm/imagefiltersbase.cpp +++ b/gm/imagefiltersbase.cpp @@ -24,14 +24,14 @@ public: SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) protected: - FailImageFilter() : INHERITED(0) {} + FailImageFilter() : INHERITED(0, NULL) {} virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE { return false; } FailImageFilter(SkReadBuffer& buffer) - : INHERITED(1, buffer) {} + : INHERITED(0, buffer) {} private: typedef SkImageFilter INHERITED; @@ -44,13 +44,13 @@ static SkFlattenable::Registrar gFailImageFilterReg("FailImageFilter", class IdentityImageFilter : public SkImageFilter { public: - static IdentityImageFilter* Create() { - return SkNEW(IdentityImageFilter); + static IdentityImageFilter* Create(SkImageFilter* input = NULL) { + return SkNEW_ARGS(IdentityImageFilter, (input)); } SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) protected: - IdentityImageFilter() : INHERITED(0) {} + IdentityImageFilter(SkImageFilter* input) : INHERITED(1, &input) {} virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE { *result = src; -- cgit v1.2.3