From 12923c46963dd1a7426973990be6575c706c60bd Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Fri, 18 Jun 2021 09:06:50 -0400 Subject: [PATCH] Move more virtuals into ...Base to hide them from public api Bug: skia:12111 Change-Id: I35601e0504e8e1186314e19bf53f01274bfc0ae0 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419357 Reviewed-by: Brian Osman Commit-Queue: Mike Reed --- include/core/SkColorFilter.h | 4 ---- include/core/SkImageFilter.h | 8 -------- include/core/SkMaskFilter.h | 8 -------- src/core/SkImageFilter_Base.h | 8 ++++++++ src/core/SkMaskFilterBase.h | 8 ++++++++ src/core/SkReadBuffer.h | 3 ++- tests/SerializationTest.cpp | 4 ++-- 7 files changed, 20 insertions(+), 23 deletions(-) diff --git a/include/core/SkColorFilter.h b/include/core/SkColorFilter.h index 0ef3f8991c..89e60f537d 100644 --- a/include/core/SkColorFilter.h +++ b/include/core/SkColorFilter.h @@ -55,10 +55,6 @@ public: */ sk_sp makeComposed(sk_sp inner) const; - static SkFlattenable::Type GetFlattenableType() { - return kSkColorFilter_Type; - } - static sk_sp Deserialize(const void* data, size_t size, const SkDeserialProcs* procs = nullptr); diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h index 17eb826108..e2240916d4 100644 --- a/include/core/SkImageFilter.h +++ b/include/core/SkImageFilter.h @@ -93,14 +93,6 @@ public: */ sk_sp makeWithLocalMatrix(const SkMatrix& matrix) const; - static SkFlattenable::Type GetFlattenableType() { - return kSkImageFilter_Type; - } - - SkFlattenable::Type getFlattenableType() const override { - return kSkImageFilter_Type; - } - static sk_sp Deserialize(const void* data, size_t size, const SkDeserialProcs* procs = nullptr) { return sk_sp(static_cast( diff --git a/include/core/SkMaskFilter.h b/include/core/SkMaskFilter.h index abf65c0c45..3fde51b717 100644 --- a/include/core/SkMaskFilter.h +++ b/include/core/SkMaskFilter.h @@ -32,14 +32,6 @@ public: static sk_sp MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM = true); - static SkFlattenable::Type GetFlattenableType() { - return kSkMaskFilter_Type; - } - - SkFlattenable::Type getFlattenableType() const override { - return kSkMaskFilter_Type; - } - /** * Returns the approximate bounds that would result from filtering the src rect. * The actual result may be different, but it should be contained within the diff --git a/src/core/SkImageFilter_Base.h b/src/core/SkImageFilter_Base.h index 1c91d2c4fd..cba26a8659 100644 --- a/src/core/SkImageFilter_Base.h +++ b/src/core/SkImageFilter_Base.h @@ -121,6 +121,14 @@ public: uint32_t uniqueID() const { return fUniqueID; } + static SkFlattenable::Type GetFlattenableType() { + return kSkImageFilter_Type; + } + + SkFlattenable::Type getFlattenableType() const override { + return kSkImageFilter_Type; + } + protected: // DEPRECATED: Will be removed once cropping is handled by a standalone image filter class CropRect { diff --git a/src/core/SkMaskFilterBase.h b/src/core/SkMaskFilterBase.h index 4b895b8a9a..69ad38e756 100644 --- a/src/core/SkMaskFilterBase.h +++ b/src/core/SkMaskFilterBase.h @@ -159,6 +159,14 @@ public: */ virtual bool asABlur(BlurRec*) const; + static SkFlattenable::Type GetFlattenableType() { + return kSkMaskFilter_Type; + } + + SkFlattenable::Type getFlattenableType() const override { + return kSkMaskFilter_Type; + } + protected: SkMaskFilterBase() {} diff --git a/src/core/SkReadBuffer.h b/src/core/SkReadBuffer.h index df0ec16739..e436d63b29 100644 --- a/src/core/SkReadBuffer.h +++ b/src/core/SkReadBuffer.h @@ -18,6 +18,7 @@ #include "include/core/SkSerialProcs.h" #include "src/core/SkBlenderBase.h" #include "src/core/SkColorFilterBase.h" +#include "src/core/SkImageFilter_Base.h" #include "src/core/SkMaskFilterBase.h" #include "src/core/SkPaintPriv.h" #include "src/core/SkPicturePriv.h" @@ -118,7 +119,7 @@ public: #ifdef SK_SUPPORT_LEGACY_DRAWLOOPER sk_sp readDrawLooper() { return this->readFlattenable(); } #endif - sk_sp readImageFilter() { return this->readFlattenable(); } + sk_sp readImageFilter() { return this->readFlattenable(); } sk_sp readBlender() { return this->readFlattenable(); } sk_sp readMaskFilter() { return this->readFlattenable(); } sk_sp readPathEffect() { return this->readFlattenable(); } diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp index 9980a339a3..97616b334f 100644 --- a/tests/SerializationTest.cpp +++ b/tests/SerializationTest.cpp @@ -281,8 +281,8 @@ static void TestBitmapSerialization(const SkBitmap& validBitmap, std::move(validBitmapSource), nullptr)); sk_sp deserializedFilter( - TestFlattenableSerialization( - xfermodeImageFilter.get(), shouldSucceed, reporter)); + TestFlattenableSerialization( + (SkImageFilter_Base*)xfermodeImageFilter.get(), shouldSucceed, reporter)); // Try to render a small bitmap using the invalid deserialized filter // to make sure we don't crash while trying to render it