| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 */ | 145 */ |
| 146 virtual void skipFlattenable(); | 146 virtual void skipFlattenable(); |
| 147 | 147 |
| 148 // binary data and arrays | 148 // binary data and arrays |
| 149 virtual bool readByteArray(void* value, size_t size); | 149 virtual bool readByteArray(void* value, size_t size); |
| 150 virtual bool readColorArray(SkColor* colors, size_t size); | 150 virtual bool readColorArray(SkColor* colors, size_t size); |
| 151 virtual bool readIntArray(int32_t* values, size_t size); | 151 virtual bool readIntArray(int32_t* values, size_t size); |
| 152 virtual bool readPointArray(SkPoint* points, size_t size); | 152 virtual bool readPointArray(SkPoint* points, size_t size); |
| 153 virtual bool readScalarArray(SkScalar* values, size_t size); | 153 virtual bool readScalarArray(SkScalar* values, size_t size); |
| 154 | 154 |
| 155 SkData* readByteArrayAsData() { | 155 sk_sp<SkData> readByteArrayAsData() { |
| 156 size_t len = this->getArrayCount(); | 156 size_t len = this->getArrayCount(); |
| 157 if (!this->validateAvailable(len)) { | 157 if (!this->validateAvailable(len)) { |
| 158 return SkData::NewEmpty(); | 158 return SkData::MakeEmpty(); |
| 159 } | 159 } |
| 160 void* buffer = sk_malloc_throw(len); | 160 void* buffer = sk_malloc_throw(len); |
| 161 this->readByteArray(buffer, len); | 161 this->readByteArray(buffer, len); |
| 162 return SkData::NewFromMalloc(buffer, len); | 162 return SkData::MakeFromMalloc(buffer, len); |
| 163 } | 163 } |
| 164 | 164 |
| 165 // helpers to get info about arrays and binary data | 165 // helpers to get info about arrays and binary data |
| 166 virtual uint32_t getArrayCount(); | 166 virtual uint32_t getArrayCount(); |
| 167 | 167 |
| 168 /** | 168 /** |
| 169 * Returns false if the bitmap could not be completely read. In that case,
it will be set | 169 * Returns false if the bitmap could not be completely read. In that case,
it will be set |
| 170 * to have width/height, but no pixels. | 170 * to have width/height, but no pixels. |
| 171 */ | 171 */ |
| 172 bool readBitmap(SkBitmap* bitmap); | 172 bool readBitmap(SkBitmap* bitmap); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 SkPicture::InstallPixelRefProc fBitmapDecoder; | 241 SkPicture::InstallPixelRefProc fBitmapDecoder; |
| 242 | 242 |
| 243 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT | 243 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT |
| 244 // Debugging counter to keep track of how many bitmaps we | 244 // Debugging counter to keep track of how many bitmaps we |
| 245 // have decoded. | 245 // have decoded. |
| 246 int fDecodedBitmapIndex; | 246 int fDecodedBitmapIndex; |
| 247 #endif // DEBUG_NON_DETERMINISTIC_ASSERT | 247 #endif // DEBUG_NON_DETERMINISTIC_ASSERT |
| 248 }; | 248 }; |
| 249 | 249 |
| 250 #endif // SkReadBuffer_DEFINED | 250 #endif // SkReadBuffer_DEFINED |
| OLD | NEW |