OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkRTConf.h" | 8 #include "SkRTConf.h" |
9 #include "SkOSFile.h" | 9 #include "SkOSFile.h" |
10 | 10 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 for (char *ptr = s ; *ptr ; ptr++) { | 208 for (char *ptr = s ; *ptr ; ptr++) { |
209 if (*ptr == search) { | 209 if (*ptr == search) { |
210 *ptr = replace; | 210 *ptr = replace; |
211 } | 211 } |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 template<typename T> bool SkRTConfRegistry::parse(const char *name, T* value) { | 215 template<typename T> bool SkRTConfRegistry::parse(const char *name, T* value) { |
216 SkString *str = NULL; | 216 SkString *str = NULL; |
217 | 217 |
218 for (int i = 0 ; i < fConfigFileKeys.count() ; i++) { | 218 for (int i = fConfigFileKeys.count() - 1 ; i >= 0; i--) { |
219 if (fConfigFileKeys[i]->equals(name)) { | 219 if (fConfigFileKeys[i]->equals(name)) { |
220 str = fConfigFileValues[i]; | 220 str = fConfigFileValues[i]; |
| 221 break; |
221 } | 222 } |
222 } | 223 } |
223 | 224 |
224 SkString environment_variable("skia."); | 225 SkString environment_variable("skia."); |
225 environment_variable.append(name); | 226 environment_variable.append(name); |
226 | 227 |
227 const char *environment_value = getenv(environment_variable.c_str()); | 228 const char *environment_value = getenv(environment_variable.c_str()); |
228 if (environment_value) { | 229 if (environment_value) { |
229 str->set(environment_value); | 230 str->set(environment_value); |
230 } else { | 231 } else { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 template void SkRTConfRegistry::set(const char *name, int value); | 287 template void SkRTConfRegistry::set(const char *name, int value); |
287 template void SkRTConfRegistry::set(const char *name, unsigned int value); | 288 template void SkRTConfRegistry::set(const char *name, unsigned int value); |
288 template void SkRTConfRegistry::set(const char *name, float value); | 289 template void SkRTConfRegistry::set(const char *name, float value); |
289 template void SkRTConfRegistry::set(const char *name, double value); | 290 template void SkRTConfRegistry::set(const char *name, double value); |
290 template void SkRTConfRegistry::set(const char *name, char * value); | 291 template void SkRTConfRegistry::set(const char *name, char * value); |
291 | 292 |
292 SkRTConfRegistry &skRTConfRegistry() { | 293 SkRTConfRegistry &skRTConfRegistry() { |
293 static SkRTConfRegistry r; | 294 static SkRTConfRegistry r; |
294 return r; | 295 return r; |
295 } | 296 } |
OLD | NEW |