Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #ifndef SkReadBuffer_DEFINED | 8 #ifndef SkReadBuffer_DEFINED |
| 9 #define SkReadBuffer_DEFINED | 9 #define SkReadBuffer_DEFINED |
| 10 | 10 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 void setTypefaceArray(SkTypeface* array[], int count) { | 190 void setTypefaceArray(SkTypeface* array[], int count) { |
| 191 fTFArray = array; | 191 fTFArray = array; |
| 192 fTFCount = count; | 192 fTFCount = count; |
| 193 } | 193 } |
| 194 | 194 |
| 195 /** | 195 /** |
| 196 * Call this with a pre-loaded array of Factories, in the same order as | 196 * Call this with a pre-loaded array of Factories, in the same order as |
| 197 * were created/written by the writer. SkPicture uses this. | 197 * were created/written by the writer. SkPicture uses this. |
| 198 */ | 198 */ |
| 199 void setFactoryPlayback(SkFlattenable::Factory array[], int count) { | 199 void setFactoryPlayback(SkFlattenable::Factory array[], int count) { |
| 200 fFactoryTDArray = nullptr; | |
| 201 fFactoryArray = array; | 200 fFactoryArray = array; |
| 202 fFactoryCount = count; | 201 fFactoryCount = count; |
| 203 } | 202 } |
| 204 | 203 |
| 205 /** | 204 /** |
| 206 * Call this with an initially empty array, so the reader can cache each | |
| 207 * factory it sees by name. Used by the pipe code in conjunction with | |
| 208 * SkWriteBuffer::setNamedFactoryRecorder. | |
| 209 */ | |
| 210 void setFactoryArray(SkTDArray<SkFlattenable::Factory>* array) { | |
|
msarett
2016/03/31 15:05:35
Nobody calls this.
| |
| 211 fFactoryTDArray = array; | |
| 212 fFactoryArray = nullptr; | |
| 213 fFactoryCount = 0; | |
| 214 } | |
| 215 | |
| 216 /** | |
| 217 * Provide a function to decode an SkBitmap from encoded data. Only used if the writer | 205 * Provide a function to decode an SkBitmap from encoded data. Only used if the writer |
| 218 * encoded the SkBitmap. If the proper decoder cannot be used, a red bitmap with the | 206 * encoded the SkBitmap. If the proper decoder cannot be used, a red bitmap with the |
| 219 * appropriate size will be used. | 207 * appropriate size will be used. |
| 220 */ | 208 */ |
| 221 void setBitmapDecoder(SkPicture::InstallPixelRefProc bitmapDecoder) { | 209 void setBitmapDecoder(SkPicture::InstallPixelRefProc bitmapDecoder) { |
| 222 fBitmapDecoder = bitmapDecoder; | 210 fBitmapDecoder = bitmapDecoder; |
| 223 } | 211 } |
| 224 | 212 |
| 225 // Default impelementations don't check anything. | 213 // Default impelementations don't check anything. |
| 226 virtual bool validate(bool isValid) { return true; } | 214 virtual bool validate(bool isValid) { return true; } |
| 227 virtual bool isValid() const { return true; } | 215 virtual bool isValid() const { return true; } |
| 228 virtual bool validateAvailable(size_t size) { return true; } | 216 virtual bool validateAvailable(size_t size) { return true; } |
| 229 | 217 |
| 230 protected: | 218 protected: |
| 231 SkReader32 fReader; | 219 SkReader32 fReader; |
| 232 | 220 |
| 233 private: | 221 private: |
| 234 bool readArray(void* value, size_t size, size_t elementSize); | 222 bool readArray(void* value, size_t size, size_t elementSize); |
| 235 | 223 |
| 236 uint32_t fFlags; | 224 uint32_t fFlags; |
| 237 int fVersion; | 225 int fVersion; |
| 238 | 226 |
| 239 void* fMemoryPtr; | 227 void* fMemoryPtr; |
| 240 | 228 |
| 241 SkBitmapHeapReader* fBitmapStorage; | 229 SkBitmapHeapReader* fBitmapStorage; |
| 242 SkTypeface** fTFArray; | 230 SkTypeface** fTFArray; |
| 243 int fTFCount; | 231 int fTFCount; |
| 244 | 232 |
| 245 SkTDArray<SkFlattenable::Factory>* fFactoryTDArray; | |
| 246 SkFlattenable::Factory* fFactoryArray; | 233 SkFlattenable::Factory* fFactoryArray; |
| 247 int fFactoryCount; | 234 int fFactoryCount; |
| 248 | 235 |
| 249 SkPicture::InstallPixelRefProc fBitmapDecoder; | 236 SkPicture::InstallPixelRefProc fBitmapDecoder; |
| 250 | 237 |
| 251 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT | 238 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT |
| 252 // Debugging counter to keep track of how many bitmaps we | 239 // Debugging counter to keep track of how many bitmaps we |
| 253 // have decoded. | 240 // have decoded. |
| 254 int fDecodedBitmapIndex; | 241 int fDecodedBitmapIndex; |
| 255 #endif // DEBUG_NON_DETERMINISTIC_ASSERT | 242 #endif // DEBUG_NON_DETERMINISTIC_ASSERT |
| 256 }; | 243 }; |
| 257 | 244 |
| 258 #endif // SkReadBuffer_DEFINED | 245 #endif // SkReadBuffer_DEFINED |
| OLD | NEW |