| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkFlattenable_DEFINED | 8 #ifndef SkFlattenable_DEFINED |
| 9 #define SkFlattenable_DEFINED | 9 #define SkFlattenable_DEFINED |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END \ | 42 #define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END \ |
| 43 } | 43 } |
| 44 | 44 |
| 45 #define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \ | 45 #define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \ |
| 46 SkFlattenable::Register(#flattenable, flattenable::CreateProc, \ | 46 SkFlattenable::Register(#flattenable, flattenable::CreateProc, \ |
| 47 flattenable::GetFlattenableType()); | 47 flattenable::GetFlattenableType()); |
| 48 | 48 |
| 49 #define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \ | 49 #define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \ |
| 50 private: \ | 50 private: \ |
| 51 static SkFlattenable* CreateProc(SkReadBuffer&); \ | 51 static SkFlattenable* CreateProc(SkReadBuffer&); \ |
| 52 friend class ::SkPrivateEffectInitializer; \ | 52 friend class SkFlattenable::PrivateInitializer; \ |
| 53 public: \ | 53 public: \ |
| 54 Factory getFactory() const override { return CreateProc; } | 54 Factory getFactory() const override { return CreateProc; } |
| 55 | 55 |
| 56 /** For SkFlattenable derived objects with a valid type | 56 /** For SkFlattenable derived objects with a valid type |
| 57 This macro should only be used in base class objects in core | 57 This macro should only be used in base class objects in core |
| 58 */ | 58 */ |
| 59 #define SK_DEFINE_FLATTENABLE_TYPE(flattenable) \ | 59 #define SK_DEFINE_FLATTENABLE_TYPE(flattenable) \ |
| 60 static Type GetFlattenableType() { \ | 60 static Type GetFlattenableType() { \ |
| 61 return k##flattenable##_Type; \ | 61 return k##flattenable##_Type; \ |
| 62 } | 62 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 static bool NameToType(const char name[], Type* type); | 101 static bool NameToType(const char name[], Type* type); |
| 102 | 102 |
| 103 static void Register(const char name[], Factory, Type); | 103 static void Register(const char name[], Factory, Type); |
| 104 | 104 |
| 105 /** | 105 /** |
| 106 * Override this if your subclass needs to record data that it will need to
recreate itself | 106 * Override this if your subclass needs to record data that it will need to
recreate itself |
| 107 * from its CreateProc (returned by getFactory()). | 107 * from its CreateProc (returned by getFactory()). |
| 108 */ | 108 */ |
| 109 virtual void flatten(SkWriteBuffer&) const {} | 109 virtual void flatten(SkWriteBuffer&) const {} |
| 110 | 110 |
| 111 protected: |
| 112 class PrivateInitializer { |
| 113 public: |
| 114 static void InitCore(); |
| 115 static void InitEffects(); |
| 116 }; |
| 117 |
| 111 private: | 118 private: |
| 112 static void InitializeFlattenablesIfNeeded(); | 119 static void InitializeFlattenablesIfNeeded(); |
| 113 | 120 |
| 114 friend class SkGraphics; | 121 friend class SkGraphics; |
| 115 | 122 |
| 116 typedef SkRefCnt INHERITED; | 123 typedef SkRefCnt INHERITED; |
| 117 }; | 124 }; |
| 118 | 125 |
| 119 #endif | 126 #endif |
| OLD | NEW |