| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkMemberInfo.h" | 10 #include "SkMemberInfo.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 hi = mid; | 46 hi = mid; |
| 47 } | 47 } |
| 48 if (gTypeIDs[hi] != type) | 48 if (gTypeIDs[hi] != type) |
| 49 return -1; | 49 return -1; |
| 50 return hi; | 50 return hi; |
| 51 } | 51 } |
| 52 | 52 |
| 53 const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* , SkDisplayTypes t
ype, int* infoCountPtr) { | 53 const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* , SkDisplayTypes t
ype, int* infoCountPtr) { |
| 54 int lookup = _searchByType(type); | 54 int lookup = _searchByType(type); |
| 55 if (lookup < 0) | 55 if (lookup < 0) |
| 56 return NULL; | 56 return nullptr; |
| 57 if (infoCountPtr) | 57 if (infoCountPtr) |
| 58 *infoCountPtr = gInfoCounts[lookup]; | 58 *infoCountPtr = gInfoCounts[lookup]; |
| 59 return gInfoTables[lookup]; | 59 return gInfoTables[lookup]; |
| 60 } | 60 } |
| 61 | 61 |
| 62 // !!! replace with inline | 62 // !!! replace with inline |
| 63 const SkMemberInfo* SkDisplayType::GetMember(SkAnimateMaker* , SkDisplayTypes ty
pe, const char** matchPtr ) { | 63 const SkMemberInfo* SkDisplayType::GetMember(SkAnimateMaker* , SkDisplayTypes ty
pe, const char** matchPtr ) { |
| 64 const SkMemberInfo* info = SkMemberInfo::Find(type, matchPtr); | 64 const SkMemberInfo* info = SkMemberInfo::Find(type, matchPtr); |
| 65 SkASSERT(info); | 65 SkASSERT(info); |
| 66 return info; | 66 return info; |
| 67 } | 67 } |
| 68 | 68 |
| 69 static const SkMemberInfo* _lookup(int lookup, const char** matchPtr) { | 69 static const SkMemberInfo* _lookup(int lookup, const char** matchPtr) { |
| 70 int count = gInfoCounts[lookup]; | 70 int count = gInfoCounts[lookup]; |
| 71 const SkMemberInfo* info = gInfoTables[lookup]; | 71 const SkMemberInfo* info = gInfoTables[lookup]; |
| 72 if (info->fType == SkType_BaseClassInfo) { | 72 if (info->fType == SkType_BaseClassInfo) { |
| 73 int baseTypeLookup = info->fOffset; | 73 int baseTypeLookup = info->fOffset; |
| 74 const SkMemberInfo* result = _lookup(baseTypeLookup, matchPtr); | 74 const SkMemberInfo* result = _lookup(baseTypeLookup, matchPtr); |
| 75 if (result != NULL) | 75 if (result != nullptr) |
| 76 return result; | 76 return result; |
| 77 if (--count == 0) | 77 if (--count == 0) |
| 78 return NULL; | 78 return nullptr; |
| 79 info++; | 79 info++; |
| 80 } | 80 } |
| 81 SkASSERT(info->fType != SkType_BaseClassInfo); | 81 SkASSERT(info->fType != SkType_BaseClassInfo); |
| 82 const char* match = *matchPtr; | 82 const char* match = *matchPtr; |
| 83 const char* strings = gInfoNames[lookup]; | 83 const char* strings = gInfoNames[lookup]; |
| 84 int index = _searchByName(&info->fName, count, strings, match); | 84 int index = _searchByName(&info->fName, count, strings, match); |
| 85 if (index < 0) | 85 if (index < 0) |
| 86 return NULL; | 86 return nullptr; |
| 87 return &info[index]; | 87 return &info[index]; |
| 88 } | 88 } |
| 89 | 89 |
| 90 const SkMemberInfo* SkMemberInfo::Find(SkDisplayTypes type, int* index) { | 90 const SkMemberInfo* SkMemberInfo::Find(SkDisplayTypes type, int* index) { |
| 91 int count = gInfoCounts[lookup]; | 91 int count = gInfoCounts[lookup]; |
| 92 const SkMemberInfo* info = gInfoTables[lookup]; | 92 const SkMemberInfo* info = gInfoTables[lookup]; |
| 93 if (info->fType == SkType_BaseClassInfo) { | 93 if (info->fType == SkType_BaseClassInfo) { |
| 94 int baseTypeLookup = info->fOffset; | 94 int baseTypeLookup = info->fOffset; |
| 95 const SkMemberInfo* result = Find(baseTypeLookup, index); | 95 const SkMemberInfo* result = Find(baseTypeLookup, index); |
| 96 if (result != NULL) | 96 if (result != nullptr) |
| 97 return result; | 97 return result; |
| 98 if (--count == 0) | 98 if (--count == 0) |
| 99 return NULL; | 99 return nullptr; |
| 100 info++; | 100 info++; |
| 101 } | 101 } |
| 102 SkASSERT(info->fType != SkType_BaseClassInfo); | 102 SkASSERT(info->fType != SkType_BaseClassInfo); |
| 103 if (*index >= count) { | 103 if (*index >= count) { |
| 104 *index -= count; | 104 *index -= count; |
| 105 return NULL; | 105 return nullptr; |
| 106 } | 106 } |
| 107 return &info[index]; | 107 return &info[index]; |
| 108 } | 108 } |
| 109 | 109 |
| 110 const SkMemberInfo* SkMemberInfo::Find(SkDisplayTypes type, const char** matchPt
r) { | 110 const SkMemberInfo* SkMemberInfo::Find(SkDisplayTypes type, const char** matchPt
r) { |
| 111 int lookup = _searchByType(type); | 111 int lookup = _searchByType(type); |
| 112 SkASSERT(lookup >= 0); | 112 SkASSERT(lookup >= 0); |
| 113 return _lookup(lookup, matchPtr); | 113 return _lookup(lookup, matchPtr); |
| 114 } | 114 } |
| 115 | 115 |
| 116 const SkMemberInfo* SkMemberInfo::getInherited() const { | 116 const SkMemberInfo* SkMemberInfo::getInherited() const { |
| 117 int baseTypeLookup = fOffset; | 117 int baseTypeLookup = fOffset; |
| 118 return gInfoTables[baseTypeLookup]; | 118 return gInfoTables[baseTypeLookup]; |
| 119 } | 119 } |
| 120 | 120 |
| 121 #endif | 121 #endif |
| OLD | NEW |