| 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" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 const Entry* entries = gEntries; | 107 const Entry* entries = gEntries; |
| 108 for (int i = gCount - 1; i >= 0; --i) { | 108 for (int i = gCount - 1; i >= 0; --i) { |
| 109 if (strcmp(entries[i].fName, name) == 0) { | 109 if (strcmp(entries[i].fName, name) == 0) { |
| 110 return entries[i].fFactory; | 110 return entries[i].fFactory; |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 return NULL; | 113 return NULL; |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool SkFlattenable::NameToType(const char name[], SkFlattenable::Type* type) { | 116 bool SkFlattenable::NameToType(const char name[], SkFlattenable::Type* type) { |
| 117 SkASSERT(NULL != type); | 117 SkASSERT(type); |
| 118 InitializeFlattenablesIfNeeded(); | 118 InitializeFlattenablesIfNeeded(); |
| 119 #ifdef SK_DEBUG | 119 #ifdef SK_DEBUG |
| 120 report_no_entries(__FUNCTION__); | 120 report_no_entries(__FUNCTION__); |
| 121 #endif | 121 #endif |
| 122 const Entry* entries = gEntries; | 122 const Entry* entries = gEntries; |
| 123 for (int i = gCount - 1; i >= 0; --i) { | 123 for (int i = gCount - 1; i >= 0; --i) { |
| 124 if (strcmp(entries[i].fName, name) == 0) { | 124 if (strcmp(entries[i].fName, name) == 0) { |
| 125 *type = entries[i].fType; | 125 *type = entries[i].fType; |
| 126 return true; | 126 return true; |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 return false; | 129 return false; |
| 130 } | 130 } |
| 131 | 131 |
| 132 const char* SkFlattenable::FactoryToName(Factory fact) { | 132 const char* SkFlattenable::FactoryToName(Factory fact) { |
| 133 InitializeFlattenablesIfNeeded(); | 133 InitializeFlattenablesIfNeeded(); |
| 134 #ifdef SK_DEBUG | 134 #ifdef SK_DEBUG |
| 135 report_no_entries(__FUNCTION__); | 135 report_no_entries(__FUNCTION__); |
| 136 #endif | 136 #endif |
| 137 const Entry* entries = gEntries; | 137 const Entry* entries = gEntries; |
| 138 for (int i = gCount - 1; i >= 0; --i) { | 138 for (int i = gCount - 1; i >= 0; --i) { |
| 139 if (entries[i].fFactory == fact) { | 139 if (entries[i].fFactory == fact) { |
| 140 return entries[i].fName; | 140 return entries[i].fName; |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 return NULL; | 143 return NULL; |
| 144 } | 144 } |
| OLD | NEW |