Expose Deserialize, so we can wean clients off of flattenable api
Follow-on CL: https://chromium-review.googlesource.com/c/chromium/src/+/2969803 Bug: skia:12111 Change-Id: Ia64433536186bb4276e5705d7bda022e0bb8bc6f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419360 Reviewed-by: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
90a0d9f618
commit
2e303cb532
@ -59,6 +59,9 @@ public:
|
||||
return kSkColorFilter_Type;
|
||||
}
|
||||
|
||||
static sk_sp<SkColorFilter> Deserialize(const void* data, size_t size,
|
||||
const SkDeserialProcs* procs = nullptr);
|
||||
|
||||
private:
|
||||
SkColorFilter() = default;
|
||||
friend class SkColorFilterBase;
|
||||
|
@ -48,11 +48,7 @@ public:
|
||||
SkRect approximateFilteredBounds(const SkRect& src) const;
|
||||
|
||||
static sk_sp<SkMaskFilter> Deserialize(const void* data, size_t size,
|
||||
const SkDeserialProcs* procs = nullptr) {
|
||||
return sk_sp<SkMaskFilter>(static_cast<SkMaskFilter*>(
|
||||
SkFlattenable::Deserialize(
|
||||
kSkMaskFilter_Type, data, size, procs).release()));
|
||||
}
|
||||
const SkDeserialProcs* procs = nullptr);
|
||||
|
||||
private:
|
||||
static void RegisterFlattenables();
|
||||
|
@ -86,6 +86,9 @@ public:
|
||||
*/
|
||||
bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect* cullR) const;
|
||||
|
||||
static sk_sp<SkPathEffect> Deserialize(const void* data, size_t size,
|
||||
const SkDeserialProcs* procs = nullptr);
|
||||
|
||||
private:
|
||||
SkPathEffect() = default;
|
||||
friend class SkPathEffectBase;
|
||||
|
@ -40,6 +40,13 @@ bool SkColorFilter::isAlphaUnchanged() const {
|
||||
return as_CFB(this)->onIsAlphaUnchanged();
|
||||
}
|
||||
|
||||
sk_sp<SkColorFilter> SkColorFilter::Deserialize(const void* data, size_t size,
|
||||
const SkDeserialProcs* procs) {
|
||||
return sk_sp<SkColorFilter>(static_cast<SkColorFilter*>(
|
||||
SkFlattenable::Deserialize(
|
||||
kSkColorFilter_Type, data, size, procs).release()));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool SkColorFilterBase::onAsAColorMode(SkColor*, SkBlendMode*) const {
|
||||
|
@ -381,3 +381,10 @@ void SkMaskFilter::RegisterFlattenables() {
|
||||
gr_register_sdf_maskfilter_createproc();
|
||||
#endif
|
||||
}
|
||||
|
||||
sk_sp<SkMaskFilter> SkMaskFilter::Deserialize(const void* data, size_t size,
|
||||
const SkDeserialProcs* procs) {
|
||||
return sk_sp<SkMaskFilter>(static_cast<SkMaskFilter*>(
|
||||
SkFlattenable::Deserialize(
|
||||
kSkMaskFilter_Type, data, size, procs).release()));
|
||||
}
|
||||
|
@ -195,3 +195,10 @@ void SkPathEffectBase::RegisterFlattenables() {
|
||||
SK_REGISTER_FLATTENABLE(SkComposePathEffect);
|
||||
SK_REGISTER_FLATTENABLE(SkSumPathEffect);
|
||||
}
|
||||
|
||||
sk_sp<SkPathEffect> SkPathEffect::Deserialize(const void* data, size_t size,
|
||||
const SkDeserialProcs* procs) {
|
||||
return sk_sp<SkPathEffect>(static_cast<SkPathEffect*>(
|
||||
SkFlattenable::Deserialize(
|
||||
kSkPathEffect_Type, data, size, procs).release()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user