| 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 | 8 |
| 9 #ifndef SkRTConf_DEFINED | 9 #ifndef SkRTConf_DEFINED |
| 10 #define SkRTConf_DEFINED | 10 #define SkRTConf_DEFINED |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 skRTConfRegistry().registerConf(this); | 108 skRTConfRegistry().registerConf(this); |
| 109 } | 109 } |
| 110 | 110 |
| 111 template<typename T> | 111 template<typename T> |
| 112 void SkRTConf<T>::print(SkWStream *o) const { | 112 void SkRTConf<T>::print(SkWStream *o) const { |
| 113 char outline[200]; // should be ok because we specify a max. width for every
thing here. | 113 char outline[200]; // should be ok because we specify a max. width for every
thing here. |
| 114 | 114 |
| 115 sprintf(outline, "%-30.30s", getName()); | 115 sprintf(outline, "%-30.30s", getName()); |
| 116 doPrint(&(outline[30])); | 116 doPrint(&(outline[30])); |
| 117 sprintf(&(outline[60]), " %.128s", fDescription.c_str()); | 117 sprintf(&(outline[60]), " %.128s", fDescription.c_str()); |
| 118 if (' ' == outline[strlen(outline)-1]) { | 118 for (size_t i = strlen(outline); i --> 0 && ' ' == outline[i];) { |
| 119 for (int i = strlen(outline)-1 ; ' ' == outline[i] ; i--) { | 119 outline[i] = '\0'; |
| 120 outline[i] = '\0'; | |
| 121 } | |
| 122 } | 120 } |
| 123 o->writeText(outline); | 121 o->writeText(outline); |
| 124 } | 122 } |
| 125 | 123 |
| 126 template<typename T> | 124 template<typename T> |
| 127 void SkRTConf<T>::doPrint(char *s) const { | 125 void SkRTConf<T>::doPrint(char *s) const { |
| 128 sprintf(s, "%-30.30s", "How do I print myself??"); | 126 sprintf(s, "%-30.30s", "How do I print myself??"); |
| 129 } | 127 } |
| 130 | 128 |
| 131 template<> inline void SkRTConf<bool>::doPrint(char *s) const { | 129 template<> inline void SkRTConf<bool>::doPrint(char *s) const { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // static_cast here is okay because there's only one kind of child class. | 167 // static_cast here is okay because there's only one kind of child class. |
| 170 const SkRTConf<T> *child_pointer = static_cast<const SkRTConf<T> *>(conf); | 168 const SkRTConf<T> *child_pointer = static_cast<const SkRTConf<T> *>(conf); |
| 171 return child_pointer && | 169 return child_pointer && |
| 172 fName == child_pointer->fName && | 170 fName == child_pointer->fName && |
| 173 fDescription == child_pointer->fDescription && | 171 fDescription == child_pointer->fDescription && |
| 174 fValue == child_pointer->fValue && | 172 fValue == child_pointer->fValue && |
| 175 fDefault == child_pointer->fDefault; | 173 fDefault == child_pointer->fDefault; |
| 176 } | 174 } |
| 177 | 175 |
| 178 #endif | 176 #endif |
| OLD | NEW |