macro to handle type-casting for SkFlattenable::Deserialize

Bug: skia:
Change-Id: If64f166cc03c32b7423361178d319474be063f19
Reviewed-on: https://skia-review.googlesource.com/87260
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2017-12-19 15:04:12 -05:00 committed by Skia Commit-Bot
parent 5c6ac64516
commit 92a2cfbcce
2 changed files with 7 additions and 2 deletions

View File

@ -64,6 +64,12 @@ struct SkDeserialProcs;
} \
Type getFlattenableType() const override { \
return k##flattenable##_Type; \
} \
static sk_sp<flattenable> Deserialize(const void* data, size_t size, \
const SkDeserialProcs* procs = nullptr) { \
return sk_sp<flattenable>(static_cast<flattenable*>( \
SkFlattenable::Deserialize( \
k##flattenable##_Type, data, size, procs).release()));\
}
/** \class SkFlattenable

View File

@ -19,6 +19,5 @@ SkFlattenable* SkValidatingDeserializeFlattenable(const void* data, size_t size,
}
sk_sp<SkImageFilter> SkValidatingDeserializeImageFilter(const void* data, size_t size) {
auto flat = SkFlattenable::Deserialize(SkFlattenable::kSkImageFilter_Type, data, size);
return sk_sp<SkImageFilter>(static_cast<SkImageFilter*>(flat.release()));
return SkImageFilter::Deserialize(data, size);
}