| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 return point; | 137 return point; |
| 138 } | 138 } |
| 139 | 139 |
| 140 SkData* readByteArrayAsData() { | 140 SkData* readByteArrayAsData() { |
| 141 size_t len = this->getArrayCount(); | 141 size_t len = this->getArrayCount(); |
| 142 void* buffer = sk_malloc_throw(len); | 142 void* buffer = sk_malloc_throw(len); |
| 143 (void)this->readByteArray(buffer, len); | 143 (void)this->readByteArray(buffer, len); |
| 144 return SkData::NewFromMalloc(buffer, len); | 144 return SkData::NewFromMalloc(buffer, len); |
| 145 } | 145 } |
| 146 | 146 |
| 147 virtual void validate(bool isValid) {} | 147 /** This function validates that the isValid input parameter is true |
| 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 |
| 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. |
| 152 * |
| 153 * @param isValid result of a test that is expected to be true |
| 154 */ |
| 155 virtual bool validate(bool isValid); |
| 148 | 156 |
| 149 private: | 157 private: |
| 150 template <typename T> T* readFlattenableT(); | 158 template <typename T> T* readFlattenableT(); |
| 151 uint32_t fFlags; | 159 uint32_t fFlags; |
| 152 }; | 160 }; |
| 153 | 161 |
| 154 /////////////////////////////////////////////////////////////////////////////// | 162 /////////////////////////////////////////////////////////////////////////////// |
| 155 | 163 |
| 156 class SkFlattenableWriteBuffer { | 164 class SkFlattenableWriteBuffer { |
| 157 public: | 165 public: |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 232 } |
| 225 | 233 |
| 226 protected: | 234 protected: |
| 227 // A helper function so that each subclass does not have to be a friend of S
kFlattenable | 235 // A helper function so that each subclass does not have to be a friend of S
kFlattenable |
| 228 void flattenObject(const SkFlattenable* obj, SkFlattenableWriteBuffer& buffe
r); | 236 void flattenObject(const SkFlattenable* obj, SkFlattenableWriteBuffer& buffe
r); |
| 229 | 237 |
| 230 uint32_t fFlags; | 238 uint32_t fFlags; |
| 231 }; | 239 }; |
| 232 | 240 |
| 233 #endif | 241 #endif |
| OLD | NEW |