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 <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2021-06-18 09:06:50 -04:00 committed by Skia Commit-Bot
parent 71bf78604b
commit 12923c4696
7 changed files with 20 additions and 23 deletions

View File

@ -55,10 +55,6 @@ public:
*/ */
sk_sp<SkColorFilter> makeComposed(sk_sp<SkColorFilter> inner) const; sk_sp<SkColorFilter> makeComposed(sk_sp<SkColorFilter> inner) const;
static SkFlattenable::Type GetFlattenableType() {
return kSkColorFilter_Type;
}
static sk_sp<SkColorFilter> Deserialize(const void* data, size_t size, static sk_sp<SkColorFilter> Deserialize(const void* data, size_t size,
const SkDeserialProcs* procs = nullptr); const SkDeserialProcs* procs = nullptr);

View File

@ -93,14 +93,6 @@ public:
*/ */
sk_sp<SkImageFilter> makeWithLocalMatrix(const SkMatrix& matrix) const; sk_sp<SkImageFilter> makeWithLocalMatrix(const SkMatrix& matrix) const;
static SkFlattenable::Type GetFlattenableType() {
return kSkImageFilter_Type;
}
SkFlattenable::Type getFlattenableType() const override {
return kSkImageFilter_Type;
}
static sk_sp<SkImageFilter> Deserialize(const void* data, size_t size, static sk_sp<SkImageFilter> Deserialize(const void* data, size_t size,
const SkDeserialProcs* procs = nullptr) { const SkDeserialProcs* procs = nullptr) {
return sk_sp<SkImageFilter>(static_cast<SkImageFilter*>( return sk_sp<SkImageFilter>(static_cast<SkImageFilter*>(

View File

@ -32,14 +32,6 @@ public:
static sk_sp<SkMaskFilter> MakeBlur(SkBlurStyle style, SkScalar sigma, static sk_sp<SkMaskFilter> MakeBlur(SkBlurStyle style, SkScalar sigma,
bool respectCTM = true); 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. * 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 * The actual result may be different, but it should be contained within the

View File

@ -121,6 +121,14 @@ public:
uint32_t uniqueID() const { return fUniqueID; } uint32_t uniqueID() const { return fUniqueID; }
static SkFlattenable::Type GetFlattenableType() {
return kSkImageFilter_Type;
}
SkFlattenable::Type getFlattenableType() const override {
return kSkImageFilter_Type;
}
protected: protected:
// DEPRECATED: Will be removed once cropping is handled by a standalone image filter // DEPRECATED: Will be removed once cropping is handled by a standalone image filter
class CropRect { class CropRect {

View File

@ -159,6 +159,14 @@ public:
*/ */
virtual bool asABlur(BlurRec*) const; virtual bool asABlur(BlurRec*) const;
static SkFlattenable::Type GetFlattenableType() {
return kSkMaskFilter_Type;
}
SkFlattenable::Type getFlattenableType() const override {
return kSkMaskFilter_Type;
}
protected: protected:
SkMaskFilterBase() {} SkMaskFilterBase() {}

View File

@ -18,6 +18,7 @@
#include "include/core/SkSerialProcs.h" #include "include/core/SkSerialProcs.h"
#include "src/core/SkBlenderBase.h" #include "src/core/SkBlenderBase.h"
#include "src/core/SkColorFilterBase.h" #include "src/core/SkColorFilterBase.h"
#include "src/core/SkImageFilter_Base.h"
#include "src/core/SkMaskFilterBase.h" #include "src/core/SkMaskFilterBase.h"
#include "src/core/SkPaintPriv.h" #include "src/core/SkPaintPriv.h"
#include "src/core/SkPicturePriv.h" #include "src/core/SkPicturePriv.h"
@ -118,7 +119,7 @@ public:
#ifdef SK_SUPPORT_LEGACY_DRAWLOOPER #ifdef SK_SUPPORT_LEGACY_DRAWLOOPER
sk_sp<SkDrawLooper> readDrawLooper() { return this->readFlattenable<SkDrawLooper>(); } sk_sp<SkDrawLooper> readDrawLooper() { return this->readFlattenable<SkDrawLooper>(); }
#endif #endif
sk_sp<SkImageFilter> readImageFilter() { return this->readFlattenable<SkImageFilter>(); } sk_sp<SkImageFilter> readImageFilter() { return this->readFlattenable<SkImageFilter_Base>(); }
sk_sp<SkBlender> readBlender() { return this->readFlattenable<SkBlenderBase>(); } sk_sp<SkBlender> readBlender() { return this->readFlattenable<SkBlenderBase>(); }
sk_sp<SkMaskFilter> readMaskFilter() { return this->readFlattenable<SkMaskFilterBase>(); } sk_sp<SkMaskFilter> readMaskFilter() { return this->readFlattenable<SkMaskFilterBase>(); }
sk_sp<SkPathEffect> readPathEffect() { return this->readFlattenable<SkPathEffect>(); } sk_sp<SkPathEffect> readPathEffect() { return this->readFlattenable<SkPathEffect>(); }

View File

@ -281,8 +281,8 @@ static void TestBitmapSerialization(const SkBitmap& validBitmap,
std::move(validBitmapSource), nullptr)); std::move(validBitmapSource), nullptr));
sk_sp<SkImageFilter> deserializedFilter( sk_sp<SkImageFilter> deserializedFilter(
TestFlattenableSerialization<SkImageFilter>( TestFlattenableSerialization<SkImageFilter_Base>(
xfermodeImageFilter.get(), shouldSucceed, reporter)); (SkImageFilter_Base*)xfermodeImageFilter.get(), shouldSucceed, reporter));
// Try to render a small bitmap using the invalid deserialized filter // Try to render a small bitmap using the invalid deserialized filter
// to make sure we don't crash while trying to render it // to make sure we don't crash while trying to render it