 |
Skia
2D Graphics Library
|
Go to the documentation of this file.
8 #ifndef SkFlattenable_DEFINED
9 #define SkFlattenable_DEFINED
61 static void Register(
const char name[], Factory);
69 virtual void flatten(SkWriteBuffer&)
const {}
90 static void RegisterFlattenablesIfNeeded();
91 static void Finalize();
98 #if defined(SK_DISABLE_EFFECT_DESERIALIZATION)
99 #define SK_REGISTER_FLATTENABLE(type) do{}while(false)
101 #define SK_FLATTENABLE_HOOKS(type) \
102 static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&); \
103 friend class SkFlattenable::PrivateInitializer; \
104 Factory getFactory() const override { return nullptr; } \
105 const char* getTypeName() const override { return #type; }
107 #define SK_REGISTER_FLATTENABLE(type) \
108 SkFlattenable::Register(#type, type::CreateProc)
110 #define SK_FLATTENABLE_HOOKS(type) \
111 static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&); \
112 friend class SkFlattenable::PrivateInitializer; \
113 Factory getFactory() const override { return type::CreateProc; } \
114 const char* getTypeName() const override { return #type; }
virtual Factory getFactory() const =0
Implement this to return a factory function pointer that can be called to recreate your class given a...
Definition: SkRefCnt.h:118
@ kSkUnused_Type
Definition: SkFlattenable.h:38
@ kSkPixelRef_Type
Definition: SkFlattenable.h:35
static sk_sp< SkFlattenable > Deserialize(Type, const void *data, size_t length, const SkDeserialProcs *procs=nullptr)
Type
Definition: SkFlattenable.h:28
SkData holds an immutable data buffer.
Definition: SkData.h:22
Definition: SkFlattenable.h:83
size_t serialize(void *memory, size_t memory_size, const SkSerialProcs *=nullptr) const
@ kSkPathEffect_Type
Definition: SkFlattenable.h:34
@ kSkMaskFilter_Type
Definition: SkFlattenable.h:33
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:215
Definition: SkGraphics.h:17
@ kSkImageFilter_Type
Definition: SkFlattenable.h:32
SkFlattenable()
Definition: SkFlattenable.h:45
sk_sp< SkData > serialize(const SkSerialProcs *=nullptr) const
#define SK_API
Definition: SkTypes.h:181
@ kSkDrawLooper_Type
Definition: SkFlattenable.h:31
static const char * FactoryToName(Factory)
@ kSkDrawable_Type
Definition: SkFlattenable.h:30
@ kSkUnused_Type2
Definition: SkFlattenable.h:39
@ kSkColorFilter_Type
Definition: SkFlattenable.h:29
static void InitImageFilters()
virtual const char * getTypeName() const =0
Returns the name of the object's class.
static void Register(const char name[], Factory)
@ kSkShaderBase_Type
Definition: SkFlattenable.h:37
virtual Type getFlattenableType() const =0
Definition: SkSerialProcs.h:50
static void InitEffects()
virtual void flatten(SkWriteBuffer &) const
Override this if your subclass needs to record data that it will need to recreate itself from its Cre...
Definition: SkFlattenable.h:69
Definition: SkSerialProcs.h:61
static Factory NameToFactory(const char name[])
@ kSkUnused_Type4
Definition: SkFlattenable.h:36
Definition: SkFlattenable.h:26
@ kSkUnused_Type3
Definition: SkFlattenable.h:40