OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 #include "SkFlattenable.h" | 8 #include "SkFlattenable.h" |
9 #include "SkPtrRecorder.h" | 9 #include "SkPtrRecorder.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
11 | 11 |
| 12 /////////////////////////////////////////////////////////////////////////////// |
| 13 |
| 14 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
| 15 bool SkFlattenable::NeedsDeepUnflatten(const SkReadBuffer& buffer) { |
| 16 return false; // TODO: looks like all this can go away too now? |
| 17 } |
| 18 #endif |
| 19 |
| 20 /////////////////////////////////////////////////////////////////////////////// |
| 21 |
12 SkNamedFactorySet::SkNamedFactorySet() : fNextAddedFactory(0) {} | 22 SkNamedFactorySet::SkNamedFactorySet() : fNextAddedFactory(0) {} |
13 | 23 |
14 uint32_t SkNamedFactorySet::find(SkFlattenable::Factory factory) { | 24 uint32_t SkNamedFactorySet::find(SkFlattenable::Factory factory) { |
15 uint32_t index = fFactorySet.find(factory); | 25 uint32_t index = fFactorySet.find(factory); |
16 if (index > 0) { | 26 if (index > 0) { |
17 return index; | 27 return index; |
18 } | 28 } |
19 const char* name = SkFlattenable::FactoryToName(factory); | 29 const char* name = SkFlattenable::FactoryToName(factory); |
20 if (NULL == name) { | 30 if (NULL == name) { |
21 return 0; | 31 return 0; |
(...skipping 18 matching lines...) Expand all Loading... |
40 | 50 |
41 void SkRefCntSet::incPtr(void* ptr) { | 51 void SkRefCntSet::incPtr(void* ptr) { |
42 ((SkRefCnt*)ptr)->ref(); | 52 ((SkRefCnt*)ptr)->ref(); |
43 } | 53 } |
44 | 54 |
45 void SkRefCntSet::decPtr(void* ptr) { | 55 void SkRefCntSet::decPtr(void* ptr) { |
46 ((SkRefCnt*)ptr)->unref(); | 56 ((SkRefCnt*)ptr)->unref(); |
47 } | 57 } |
48 | 58 |
49 /////////////////////////////////////////////////////////////////////////////// | 59 /////////////////////////////////////////////////////////////////////////////// |
| 60 /////////////////////////////////////////////////////////////////////////////// |
| 61 /////////////////////////////////////////////////////////////////////////////// |
50 | 62 |
51 #define MAX_ENTRY_COUNT 1024 | 63 #define MAX_ENTRY_COUNT 1024 |
52 | 64 |
53 struct Entry { | 65 struct Entry { |
54 const char* fName; | 66 const char* fName; |
55 SkFlattenable::Factory fFactory; | 67 SkFlattenable::Factory fFactory; |
56 SkFlattenable::Type fType; | 68 SkFlattenable::Type fType; |
57 }; | 69 }; |
58 | 70 |
59 static int gCount; | 71 static int gCount; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 report_no_entries(__FUNCTION__); | 135 report_no_entries(__FUNCTION__); |
124 #endif | 136 #endif |
125 const Entry* entries = gEntries; | 137 const Entry* entries = gEntries; |
126 for (int i = gCount - 1; i >= 0; --i) { | 138 for (int i = gCount - 1; i >= 0; --i) { |
127 if (entries[i].fFactory == fact) { | 139 if (entries[i].fFactory == fact) { |
128 return entries[i].fName; | 140 return entries[i].fName; |
129 } | 141 } |
130 } | 142 } |
131 return NULL; | 143 return NULL; |
132 } | 144 } |
OLD | NEW |