| Index: include/core/SkFlattenable.h
|
| diff --git a/include/core/SkFlattenable.h b/include/core/SkFlattenable.h
|
| index f6d377a9d743b4838f6e2e6206053f0056729bee..c3392faf7fe3fadf41436d0b3c92d9a9f9e53aae 100644
|
| --- a/include/core/SkFlattenable.h
|
| +++ b/include/core/SkFlattenable.h
|
| @@ -1,4 +1,3 @@
|
| -
|
| /*
|
| * Copyright 2006 The Android Open Source Project
|
| *
|
| @@ -6,12 +5,13 @@
|
| * found in the LICENSE file.
|
| */
|
|
|
| -
|
| #ifndef SkFlattenable_DEFINED
|
| #define SkFlattenable_DEFINED
|
|
|
| #include "SkRefCnt.h"
|
|
|
| +//#define SK_SUPPORT_LEGACY_DEEPFLATTENING
|
| +
|
| class SkReadBuffer;
|
| class SkWriteBuffer;
|
|
|
| @@ -30,11 +30,21 @@ class SkWriteBuffer;
|
| #define SK_DECLARE_UNFLATTENABLE_OBJECT() \
|
| virtual Factory getFactory() const SK_OVERRIDE { return NULL; }
|
|
|
| -#define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \
|
| - virtual Factory getFactory() const SK_OVERRIDE { return CreateProc; } \
|
| - static SkFlattenable* CreateProc(SkReadBuffer& buffer) { \
|
| - return SkNEW_ARGS(flattenable, (buffer)); \
|
| +#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
|
| +#define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \
|
| + static SkFlattenable* CreateProc(SkReadBuffer&); \
|
| + virtual Factory getFactory() const SK_OVERRIDE {return DeepCreateProc;} \
|
| + static SkFlattenable* DeepCreateProc(SkReadBuffer& buffer) { \
|
| + if (NeedsDeepUnflatten(buffer)) { \
|
| + return SkNEW_ARGS(flattenable, (buffer)); \
|
| + } \
|
| + return CreateProc(buffer); \
|
| }
|
| +#else
|
| +#define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \
|
| + static SkFlattenable* CreateProc(SkReadBuffer&); \
|
| + virtual Factory getFactory() const SK_OVERRIDE { return CreateProc; }
|
| +#endif
|
|
|
| /** For SkFlattenable derived objects with a valid type
|
| This macro should only be used in base class objects in core
|
| @@ -101,7 +111,13 @@ public:
|
| virtual void flatten(SkWriteBuffer&) const;
|
|
|
| protected:
|
| +#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
|
| + enum {
|
| + kNewFlattenVersion = 27
|
| + };
|
| + static bool NeedsDeepUnflatten(const SkReadBuffer&);
|
| SkFlattenable(SkReadBuffer&) {}
|
| +#endif
|
|
|
| private:
|
| static void InitializeFlattenablesIfNeeded();
|
|
|