OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
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 #ifndef SkFlattenableBuffers_DEFINED | 9 #ifndef SkFlattenableBuffers_DEFINED |
10 #define SkFlattenableBuffers_DEFINED | 10 #define SkFlattenableBuffers_DEFINED |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 /** This function validates that the isValid input parameter is true | 147 /** This function validates that the isValid input parameter is true |
148 * If isValidating() is false, then true is always returned | 148 * If isValidating() is false, then true is always returned |
149 * If isValidating() is true, then true is returned until validate() is cal
led with isValid | 149 * If isValidating() is true, then true is returned until validate() is cal
led with isValid |
150 * set to false. When isValid is false, an error flag will be set internall
y and, from that | 150 * set to false. When isValid is false, an error flag will be set internall
y and, from that |
151 * point on, validate() will return false. The error flag cannot be unset. | 151 * point on, validate() will return false. The error flag cannot be unset. |
152 * | 152 * |
153 * @param isValid result of a test that is expected to be true | 153 * @param isValid result of a test that is expected to be true |
154 */ | 154 */ |
155 virtual bool validate(bool isValid); | 155 virtual bool validate(bool isValid); |
156 | 156 |
| 157 /** This function returns true by default |
| 158 * If isValidating() is true, it will return false if the internal error fl
ag is set. |
| 159 * Otherwise, it will return true. |
| 160 */ |
| 161 virtual bool isValid() const { return true; } |
| 162 |
157 private: | 163 private: |
158 template <typename T> T* readFlattenableT(); | 164 template <typename T> T* readFlattenableT(); |
159 uint32_t fFlags; | 165 uint32_t fFlags; |
160 }; | 166 }; |
161 | 167 |
162 /////////////////////////////////////////////////////////////////////////////// | 168 /////////////////////////////////////////////////////////////////////////////// |
163 | 169 |
164 class SkFlattenableWriteBuffer { | 170 class SkFlattenableWriteBuffer { |
165 public: | 171 public: |
166 SkFlattenableWriteBuffer(); | 172 SkFlattenableWriteBuffer(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 238 } |
233 | 239 |
234 protected: | 240 protected: |
235 // A helper function so that each subclass does not have to be a friend of S
kFlattenable | 241 // A helper function so that each subclass does not have to be a friend of S
kFlattenable |
236 void flattenObject(const SkFlattenable* obj, SkFlattenableWriteBuffer& buffe
r); | 242 void flattenObject(const SkFlattenable* obj, SkFlattenableWriteBuffer& buffe
r); |
237 | 243 |
238 uint32_t fFlags; | 244 uint32_t fFlags; |
239 }; | 245 }; |
240 | 246 |
241 #endif | 247 #endif |
OLD | NEW |