Make SK_DISABLE_EFFECT_SERIALIZATION trim out more code

This shrinks uncompressed CanvasKit by just over 15K

Change-Id: I2495b235cdbc201811195c93b9f3b31409dfd9c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295198
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Brian Osman 2020-06-09 10:02:59 -04:00 committed by Skia Commit-Bot
parent 8f45e4d1b5
commit 5c9d18170b

View File

@ -95,12 +95,23 @@ private:
typedef SkRefCnt INHERITED;
};
#define SK_REGISTER_FLATTENABLE(type) SkFlattenable::Register(#type, type::CreateProc)
#if defined(SK_DISABLE_EFFECT_DESERIALIZATION)
#define SK_REGISTER_FLATTENABLE(type) do{}while(false)
#define SK_FLATTENABLE_HOOKS(type) \
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&); \
friend class SkFlattenable::PrivateInitializer; \
Factory getFactory() const override { return type::CreateProc; } \
const char* getTypeName() const override { return #type; }
#define SK_FLATTENABLE_HOOKS(type) \
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&); \
friend class SkFlattenable::PrivateInitializer; \
Factory getFactory() const override { return nullptr; } \
const char* getTypeName() const override { return #type; }
#else
#define SK_REGISTER_FLATTENABLE(type) \
SkFlattenable::Register(#type, type::CreateProc)
#define SK_FLATTENABLE_HOOKS(type) \
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&); \
friend class SkFlattenable::PrivateInitializer; \
Factory getFactory() const override { return type::CreateProc; } \
const char* getTypeName() const override { return #type; }
#endif
#endif