| 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 27 matching lines...) Expand all Loading... |
| 38 SkReadBuffer(const void* data, size_t size); | 38 SkReadBuffer(const void* data, size_t size); |
| 39 SkReadBuffer(SkStream* stream); | 39 SkReadBuffer(SkStream* stream); |
| 40 virtual ~SkReadBuffer(); | 40 virtual ~SkReadBuffer(); |
| 41 | 41 |
| 42 enum Version { | 42 enum Version { |
| 43 kFilterLevelIsEnum_Version = 23, | 43 kFilterLevelIsEnum_Version = 23, |
| 44 kGradientFlippedFlag_Version = 24, | 44 kGradientFlippedFlag_Version = 24, |
| 45 kDashWritesPhaseIntervals_Version = 25, | 45 kDashWritesPhaseIntervals_Version = 25, |
| 46 kColorShaderNoBool_Version = 26, | 46 kColorShaderNoBool_Version = 26, |
| 47 kNoUnitMappers_Version = 27, | 47 kNoUnitMappers_Version = 27, |
| 48 kNoMoreBitmapFlatten_Version = 28, |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 /** | 51 /** |
| 51 * Returns true IFF the version is older than the specified version. | 52 * Returns true IFF the version is older than the specified version. |
| 52 */ | 53 */ |
| 53 bool isVersionLT(Version targetVersion) const { | 54 bool isVersionLT(Version targetVersion) const { |
| 54 SkASSERT(targetVersion > 0); | 55 SkASSERT(targetVersion > 0); |
| 55 return fVersion > 0 && fVersion < targetVersion; | 56 return fVersion > 0 && fVersion < targetVersion; |
| 56 } | 57 } |
| 57 | 58 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 return SkData::NewEmpty(); | 143 return SkData::NewEmpty(); |
| 143 } | 144 } |
| 144 void* buffer = sk_malloc_throw(len); | 145 void* buffer = sk_malloc_throw(len); |
| 145 this->readByteArray(buffer, len); | 146 this->readByteArray(buffer, len); |
| 146 return SkData::NewFromMalloc(buffer, len); | 147 return SkData::NewFromMalloc(buffer, len); |
| 147 } | 148 } |
| 148 | 149 |
| 149 // helpers to get info about arrays and binary data | 150 // helpers to get info about arrays and binary data |
| 150 virtual uint32_t getArrayCount(); | 151 virtual uint32_t getArrayCount(); |
| 151 | 152 |
| 152 virtual void readBitmap(SkBitmap* bitmap); | 153 /** |
| 154 * Returns false if the bitmap could not be completely read. In that case,
it will be set |
| 155 * to have width/height, but no pixels. |
| 156 */ |
| 157 bool readBitmap(SkBitmap* bitmap); |
| 158 |
| 153 virtual SkTypeface* readTypeface(); | 159 virtual SkTypeface* readTypeface(); |
| 154 | 160 |
| 155 void setBitmapStorage(SkBitmapHeapReader* bitmapStorage) { | 161 void setBitmapStorage(SkBitmapHeapReader* bitmapStorage) { |
| 156 SkRefCnt_SafeAssign(fBitmapStorage, bitmapStorage); | 162 SkRefCnt_SafeAssign(fBitmapStorage, bitmapStorage); |
| 157 } | 163 } |
| 158 | 164 |
| 159 void setTypefaceArray(SkTypeface* array[], int count) { | 165 void setTypefaceArray(SkTypeface* array[], int count) { |
| 160 fTFArray = array; | 166 fTFArray = array; |
| 161 fTFCount = count; | 167 fTFCount = count; |
| 162 } | 168 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 SkPicture::InstallPixelRefProc fBitmapDecoder; | 224 SkPicture::InstallPixelRefProc fBitmapDecoder; |
| 219 | 225 |
| 220 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT | 226 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT |
| 221 // Debugging counter to keep track of how many bitmaps we | 227 // Debugging counter to keep track of how many bitmaps we |
| 222 // have decoded. | 228 // have decoded. |
| 223 int fDecodedBitmapIndex; | 229 int fDecodedBitmapIndex; |
| 224 #endif // DEBUG_NON_DETERMINISTIC_ASSERT | 230 #endif // DEBUG_NON_DETERMINISTIC_ASSERT |
| 225 }; | 231 }; |
| 226 | 232 |
| 227 #endif // SkReadBuffer_DEFINED | 233 #endif // SkReadBuffer_DEFINED |
| OLD | NEW |