From 19d7bd65045e88724ad59a8d7066a9092754c7e4 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Mon, 19 Feb 2018 14:10:57 -0500 Subject: hide virtual and rename to onMakeComposed Bug: skia: Change-Id: Ic18ee2af3273f81ebec9c9031162e808186c0acd Reviewed-on: https://skia-review.googlesource.com/108300 Reviewed-by: Mike Reed Commit-Queue: Mike Reed --- include/core/SkColorFilter.h | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'include/core/SkColorFilter.h') diff --git a/include/core/SkColorFilter.h b/include/core/SkColorFilter.h index fde3d26345..1bf18429cd 100644 --- a/include/core/SkColorFilter.h +++ b/include/core/SkColorFilter.h @@ -76,15 +76,6 @@ public: */ virtual uint32_t getFlags() const { return 0; } - /** - * If this subclass can optimally createa composition with the inner filter, return it as - * a new filter (which the caller must unref() when it is done). If no such optimization - * is known, return NULL. - * - * e.g. result(color) == this_filter(inner(color)) - */ - virtual sk_sp makeComposed(sk_sp) const { return nullptr; } - SkColor filterColor(SkColor) const; SkColor4f filterColor4f(const SkColor4f&) const; @@ -100,14 +91,20 @@ public: static sk_sp MakeModeFilter(SkColor c, SkBlendMode mode); /** Construct a colorfilter whose effect is to first apply the inner filter and then apply - * the outer filter to the result of the inner's. - * The reference counts for outer and inner are incremented. + * this filter, applied to the output of the inner filter. + * + * result = this(inner(...)) * * Due to internal limits, it is possible that this will return NULL, so the caller must * always check. */ + sk_sp makeComposed(sk_sp inner) const; + + // DEPRECATED, call makeComposed instead static sk_sp MakeComposeFilter(sk_sp outer, - sk_sp inner); + sk_sp inner) { + return outer ? outer->makeComposed(inner) : inner; + } /** Construct a color filter that transforms a color by a 4x5 matrix. The matrix is in row- * major order and the translation column is specified in unnormalized, 0...255, space. @@ -155,6 +152,15 @@ protected: return sk_ref_sp(const_cast(this)); } + /** + * If this subclass can optimally createa composition with the inner filter, return it as + * a new filter (which the caller must unref() when it is done). If no such optimization + * is known, return NULL. + * + * e.g. result(color) == this_filter(inner(color)) + */ + virtual sk_sp onMakeComposed(sk_sp) const { return nullptr; } + private: /* * Returns 1 if this is a single filter (not a composition of other filters), otherwise it -- cgit v1.2.3