From 5c9d18170b07a763c6b10baf8017d0ea7c1545cd Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Tue, 9 Jun 2020 10:02:59 -0400 Subject: [PATCH] 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 Commit-Queue: Mike Klein --- include/core/SkFlattenable.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/include/core/SkFlattenable.h b/include/core/SkFlattenable.h index 2f69282962..bb9d70faef 100644 --- a/include/core/SkFlattenable.h +++ b/include/core/SkFlattenable.h @@ -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 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 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 CreateProc(SkReadBuffer&); \ + friend class SkFlattenable::PrivateInitializer; \ + Factory getFactory() const override { return type::CreateProc; } \ + const char* getTypeName() const override { return #type; } +#endif #endif