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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 bool isDefault() const { return fDefault == fValue; } | 42 bool isDefault() const { return fDefault == fValue; } |
43 void set(const T& value) { fValue = value; } | 43 void set(const T& value) { fValue = value; } |
44 protected: | 44 protected: |
45 void doPrint(char *s) const; | 45 void doPrint(char *s) const; |
46 | 46 |
47 T fValue; | 47 T fValue; |
48 T fDefault; | 48 T fDefault; |
49 SkString fDescription; | 49 SkString fDescription; |
50 }; | 50 }; |
51 | 51 |
52 #ifdef SK_DEVELOPER | 52 #ifdef SK_DEBUG |
53 #define SK_CONF_DECLARE(confType, varName, confName, defaultValue, description)
static SkRTConf<confType> varName(confName, defaultValue, description) | 53 #define SK_CONF_DECLARE(confType, varName, confName, defaultValue, description)
static SkRTConf<confType> varName(confName, defaultValue, description) |
54 #define SK_CONF_SET(confname, value) \ | 54 #define SK_CONF_SET(confname, value) \ |
55 skRTConfRegistry().set(confname, value, true) | 55 skRTConfRegistry().set(confname, value, true) |
56 /* SK_CONF_TRY_SET() is like SK_CONF_SET(), but doesn't complain if | 56 /* SK_CONF_TRY_SET() is like SK_CONF_SET(), but doesn't complain if |
57 confname can't be found. This is useful if the SK_CONF_DECLARE is | 57 confname can't be found. This is useful if the SK_CONF_DECLARE is |
58 inside a source file whose linkage is dependent on the system. */ | 58 inside a source file whose linkage is dependent on the system. */ |
59 #define SK_CONF_TRY_SET(confname, value) \ | 59 #define SK_CONF_TRY_SET(confname, value) \ |
60 skRTConfRegistry().set(confname, value, false) | 60 skRTConfRegistry().set(confname, value, false) |
61 #else | 61 #else |
62 #define SK_CONF_DECLARE(confType, varName, confName, defaultValue, description)
static confType varName = defaultValue | 62 #define SK_CONF_DECLARE(confType, varName, confName, defaultValue, description)
static confType varName = defaultValue |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // static_cast here is okay because there's only one kind of child class. | 184 // static_cast here is okay because there's only one kind of child class. |
185 const SkRTConf<T> *child_pointer = static_cast<const SkRTConf<T> *>(conf); | 185 const SkRTConf<T> *child_pointer = static_cast<const SkRTConf<T> *>(conf); |
186 return child_pointer && | 186 return child_pointer && |
187 fName == child_pointer->fName && | 187 fName == child_pointer->fName && |
188 fDescription == child_pointer->fDescription && | 188 fDescription == child_pointer->fDescription && |
189 fValue == child_pointer->fValue && | 189 fValue == child_pointer->fValue && |
190 fDefault == child_pointer->fDefault; | 190 fDefault == child_pointer->fDefault; |
191 } | 191 } |
192 | 192 |
193 #endif | 193 #endif |
OLD | NEW |