| OLD | NEW |
| 1 Flattenables | 1 Flattenables |
| 2 ============ | 2 ============ |
| 3 | 3 |
| 4 Many objects in Skia, such as SkShaders and other effects on SkPaint, need to be
| 4 Many objects in Skia, such as SkShaders and other effects on SkPaint, need to be
|
| 5 flattened into a data stream for either transport or as part of the key to the | 5 flattened into a data stream for either transport or as part of the key to the |
| 6 font cache. Classes for these objects should derive from SkFlattenable or one of
| 6 font cache. Classes for these objects should derive from SkFlattenable or one of
|
| 7 its subclasses. If you create a new flattenable class, you need to make sure you
| 7 its subclasses. If you create a new flattenable class, you need to make sure you
|
| 8 do a few things so that it will work on all platforms: | 8 do a few things so that it will work on all platforms: |
| 9 | 9 |
| 10 1: Override the method flatten (the default scope is protected): | 10 1: Override the method flatten (the default scope is protected): |
| 11 | 11 |
| 12 <!--?prettify?--> | 12 <!--?prettify?--> |
| 13 ~~~~ | 13 ~~~~ |
| 14 virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE { | 14 virtual void flatten(SkFlattenableWriteBuffer& buffer) const override { |
| 15 this->INHERITED::flatten(buffer); | 15 this->INHERITED::flatten(buffer); |
| 16 // Write any private data that needs to be stored to recreate this object | 16 // Write any private data that needs to be stored to recreate this object |
| 17 } | 17 } |
| 18 ~~~~ | 18 ~~~~ |
| 19 | 19 |
| 20 2: Override the (protected) constructor that creates an object from an | 20 2: Override the (protected) constructor that creates an object from an |
| 21 SkFlattenableReadBuffer: | 21 SkFlattenableReadBuffer: |
| 22 | 22 |
| 23 <!--?prettify?--> | 23 <!--?prettify?--> |
| 24 ~~~~ | 24 ~~~~ |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkNewClass) | 79 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkNewClass) |
| 80 ~~~~ | 80 ~~~~ |
| 81 | 81 |
| 82 For a group, add | 82 For a group, add |
| 83 | 83 |
| 84 <!--?prettify?--> | 84 <!--?prettify?--> |
| 85 ~~~~ | 85 ~~~~ |
| 86 SkGroupClass::InitializeFlattenables(); | 86 SkGroupClass::InitializeFlattenables(); |
| 87 ~~~~ | 87 ~~~~ |
| 88 | 88 |
| OLD | NEW |