OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 SkReadBuffer_DEFINED | 9 #ifndef SkReadBuffer_DEFINED |
10 #define SkReadBuffer_DEFINED | 10 #define SkReadBuffer_DEFINED |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 */ | 170 */ |
171 void setBitmapDecoder(SkPicture::InstallPixelRefProc bitmapDecoder) { | 171 void setBitmapDecoder(SkPicture::InstallPixelRefProc bitmapDecoder) { |
172 fBitmapDecoder = bitmapDecoder; | 172 fBitmapDecoder = bitmapDecoder; |
173 } | 173 } |
174 | 174 |
175 // Default impelementations don't check anything. | 175 // Default impelementations don't check anything. |
176 virtual bool validate(bool isValid) { return true; } | 176 virtual bool validate(bool isValid) { return true; } |
177 virtual bool isValid() const { return true; } | 177 virtual bool isValid() const { return true; } |
178 virtual bool validateAvailable(size_t size) { return true; } | 178 virtual bool validateAvailable(size_t size) { return true; } |
179 | 179 |
| 180 protected: |
| 181 SkReader32 fReader; |
| 182 |
180 private: | 183 private: |
181 bool readArray(void* value, size_t size, size_t elementSize); | 184 bool readArray(void* value, size_t size, size_t elementSize); |
182 | 185 |
183 uint32_t fFlags; | 186 uint32_t fFlags; |
184 | 187 |
185 SkReader32 fReader; | |
186 void* fMemoryPtr; | 188 void* fMemoryPtr; |
187 | 189 |
188 SkBitmapHeapReader* fBitmapStorage; | 190 SkBitmapHeapReader* fBitmapStorage; |
189 SkTypeface** fTFArray; | 191 SkTypeface** fTFArray; |
190 int fTFCount; | 192 int fTFCount; |
191 | 193 |
192 SkTDArray<SkFlattenable::Factory>* fFactoryTDArray; | 194 SkTDArray<SkFlattenable::Factory>* fFactoryTDArray; |
193 SkFlattenable::Factory* fFactoryArray; | 195 SkFlattenable::Factory* fFactoryArray; |
194 int fFactoryCount; | 196 int fFactoryCount; |
195 | 197 |
196 SkPicture::InstallPixelRefProc fBitmapDecoder; | 198 SkPicture::InstallPixelRefProc fBitmapDecoder; |
197 | 199 |
198 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT | 200 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT |
199 // Debugging counter to keep track of how many bitmaps we | 201 // Debugging counter to keep track of how many bitmaps we |
200 // have decoded. | 202 // have decoded. |
201 int fDecodedBitmapIndex; | 203 int fDecodedBitmapIndex; |
202 #endif // DEBUG_NON_DETERMINISTIC_ASSERT | 204 #endif // DEBUG_NON_DETERMINISTIC_ASSERT |
203 }; | 205 }; |
204 | 206 |
205 #endif // SkReadBuffer_DEFINED | 207 #endif // SkReadBuffer_DEFINED |
OLD | NEW |