OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
| 7 |
8 #include "SkFlattenable.h" | 8 #include "SkFlattenable.h" |
9 #include "SkPtrRecorder.h" | 9 #include "SkPtrRecorder.h" |
| 10 #include "SkReadBuffer.h" |
10 | 11 |
11 /////////////////////////////////////////////////////////////////////////////// | 12 /////////////////////////////////////////////////////////////////////////////// |
12 | 13 |
13 void SkFlattenable::flatten(SkWriteBuffer&) const | 14 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
14 { | 15 bool SkFlattenable::NeedsDeepUnflatten(const SkReadBuffer& buffer) { |
15 /* we don't write anything at the moment, but this allows our subclasses | 16 return buffer.isVersionLT(SkReadBuffer::kFlattenCreateProc_Version); |
16 to not know that, since we want them to always call INHERITED::flatten() | |
17 in their code. | |
18 */ | |
19 } | 17 } |
| 18 #endif |
| 19 |
| 20 void SkFlattenable::flatten(SkWriteBuffer&) const {} |
20 | 21 |
21 /////////////////////////////////////////////////////////////////////////////// | 22 /////////////////////////////////////////////////////////////////////////////// |
22 | 23 |
23 SkNamedFactorySet::SkNamedFactorySet() : fNextAddedFactory(0) {} | 24 SkNamedFactorySet::SkNamedFactorySet() : fNextAddedFactory(0) {} |
24 | 25 |
25 uint32_t SkNamedFactorySet::find(SkFlattenable::Factory factory) { | 26 uint32_t SkNamedFactorySet::find(SkFlattenable::Factory factory) { |
26 uint32_t index = fFactorySet.find(factory); | 27 uint32_t index = fFactorySet.find(factory); |
27 if (index > 0) { | 28 if (index > 0) { |
28 return index; | 29 return index; |
29 } | 30 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 report_no_entries(__FUNCTION__); | 137 report_no_entries(__FUNCTION__); |
137 #endif | 138 #endif |
138 const Entry* entries = gEntries; | 139 const Entry* entries = gEntries; |
139 for (int i = gCount - 1; i >= 0; --i) { | 140 for (int i = gCount - 1; i >= 0; --i) { |
140 if (entries[i].fFactory == fact) { | 141 if (entries[i].fFactory == fact) { |
141 return entries[i].fName; | 142 return entries[i].fName; |
142 } | 143 } |
143 } | 144 } |
144 return NULL; | 145 return NULL; |
145 } | 146 } |
OLD | NEW |