| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 return SkData::MakeEmpty(); | 159 return SkData::MakeEmpty(); |
| 160 } | 160 } |
| 161 void* buffer = sk_malloc_throw(len); | 161 void* buffer = sk_malloc_throw(len); |
| 162 this->readByteArray(buffer, len); | 162 this->readByteArray(buffer, len); |
| 163 return SkData::MakeFromMalloc(buffer, len); | 163 return SkData::MakeFromMalloc(buffer, len); |
| 164 } | 164 } |
| 165 | 165 |
| 166 // helpers to get info about arrays and binary data | 166 // helpers to get info about arrays and binary data |
| 167 virtual uint32_t getArrayCount(); | 167 virtual uint32_t getArrayCount(); |
| 168 | 168 |
| 169 /** | |
| 170 * Returns false if the image could not be completely read. In that case, i
t will be set | |
| 171 * to have width/height, but no pixels. | |
| 172 */ | |
| 173 sk_sp<SkImage> readBitmapAsImage(); | 169 sk_sp<SkImage> readBitmapAsImage(); |
| 174 sk_sp<SkImage> readImage(); | 170 sk_sp<SkImage> readImage(); |
| 175 | 171 virtual sk_sp<SkTypeface> readTypeface(); |
| 176 virtual SkTypeface* readTypeface(); | |
| 177 | 172 |
| 178 void setTypefaceArray(SkTypeface* array[], int count) { | 173 void setTypefaceArray(SkTypeface* array[], int count) { |
| 179 fTFArray = array; | 174 fTFArray = array; |
| 180 fTFCount = count; | 175 fTFCount = count; |
| 181 } | 176 } |
| 182 | 177 |
| 183 /** | 178 /** |
| 184 * Call this with a pre-loaded array of Factories, in the same order as | 179 * Call this with a pre-loaded array of Factories, in the same order as |
| 185 * were created/written by the writer. SkPicture uses this. | 180 * were created/written by the writer. SkPicture uses this. |
| 186 */ | 181 */ |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 SkImageDeserializer* fImageDeserializer; | 252 SkImageDeserializer* fImageDeserializer; |
| 258 | 253 |
| 259 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT | 254 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT |
| 260 // Debugging counter to keep track of how many bitmaps we | 255 // Debugging counter to keep track of how many bitmaps we |
| 261 // have decoded. | 256 // have decoded. |
| 262 int fDecodedBitmapIndex; | 257 int fDecodedBitmapIndex; |
| 263 #endif // DEBUG_NON_DETERMINISTIC_ASSERT | 258 #endif // DEBUG_NON_DETERMINISTIC_ASSERT |
| 264 }; | 259 }; |
| 265 | 260 |
| 266 #endif // SkReadBuffer_DEFINED | 261 #endif // SkReadBuffer_DEFINED |
| OLD | NEW |