8 #ifndef SkFlattenable_DEFINED
9 #define SkFlattenable_DEFINED
16 class SkPrivateEffectInitializer;
37 #define SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() static void InitializeFlattenables();
39 #define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(flattenable) \
40 void flattenable::InitializeFlattenables() {
42 #define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END \
45 #define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \
46 SkFlattenable::Register(#flattenable, flattenable::CreateProc, \
47 flattenable::GetFlattenableType());
49 #define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \
51 static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&); \
52 friend class SkFlattenable::PrivateInitializer; \
54 Factory getFactory() const override { return CreateProc; }
59 #define SK_DEFINE_FLATTENABLE_TYPE(flattenable) \
60 static Type GetFlattenableType() { \
61 return k##flattenable##_Type; \
83 kSkUnused_Xfermode_Type,
95 virtual Factory getFactory()
const = 0;
105 virtual const char*
getTypeName()
const {
return FactoryToName(getFactory()); }
107 static Factory NameToFactory(
const char name[]);
108 static const char* FactoryToName(Factory);
109 static bool NameToType(
const char name[], Type* type);
111 static void Register(
const char name[], Factory, Type);
122 static void InitCore();
123 static void InitEffects();
127 static void InitializeFlattenablesIfNeeded();
Definition: SkRefCnt.h:125
SkFlattenable is the base class for objects that need to be flattened into a data stream for either t...
Definition: SkFlattenable.h:70
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:246
Definition: SkWriteBuffer.h:27
Definition: SkFlattenable.h:120
virtual const char * getTypeName() const
Returns the name of the object's class.
Definition: SkFlattenable.h:105
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:117
Definition: SkGraphics.h:17