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 |
11 #include "SkBitmapHeap.h" | |
12 #include "SkColorFilter.h" | 11 #include "SkColorFilter.h" |
13 #include "SkData.h" | 12 #include "SkData.h" |
14 #include "SkDrawLooper.h" | 13 #include "SkDrawLooper.h" |
15 #include "SkImageFilter.h" | 14 #include "SkImageFilter.h" |
16 #include "SkMaskFilter.h" | 15 #include "SkMaskFilter.h" |
17 #include "SkPath.h" | 16 #include "SkPath.h" |
18 #include "SkPathEffect.h" | 17 #include "SkPathEffect.h" |
19 #include "SkPicture.h" | 18 #include "SkPicture.h" |
20 #include "SkRasterizer.h" | 19 #include "SkRasterizer.h" |
21 #include "SkReadBuffer.h" | 20 #include "SkReadBuffer.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 /** | 168 /** |
170 * 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 |
171 * to have width/height, but no pixels. | 170 * to have width/height, but no pixels. |
172 */ | 171 */ |
173 bool readBitmap(SkBitmap* bitmap); | 172 bool readBitmap(SkBitmap* bitmap); |
174 | 173 |
175 SkImage* readImage(); | 174 SkImage* readImage(); |
176 | 175 |
177 virtual SkTypeface* readTypeface(); | 176 virtual SkTypeface* readTypeface(); |
178 | 177 |
179 void setBitmapStorage(SkBitmapHeapReader* bitmapStorage) { | |
180 SkRefCnt_SafeAssign(fBitmapStorage, bitmapStorage); | |
181 } | |
182 | |
183 void setTypefaceArray(SkTypeface* array[], int count) { | 178 void setTypefaceArray(SkTypeface* array[], int count) { |
184 fTFArray = array; | 179 fTFArray = array; |
185 fTFCount = count; | 180 fTFCount = count; |
186 } | 181 } |
187 | 182 |
188 /** | 183 /** |
189 * Call this with a pre-loaded array of Factories, in the same order as | 184 * Call this with a pre-loaded array of Factories, in the same order as |
190 * were created/written by the writer. SkPicture uses this. | 185 * were created/written by the writer. SkPicture uses this. |
191 */ | 186 */ |
192 void setFactoryPlayback(SkFlattenable::Factory array[], int count) { | 187 void setFactoryPlayback(SkFlattenable::Factory array[], int count) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 SkTHashMap<uint32_t, SkString> fFlattenableDict; | 243 SkTHashMap<uint32_t, SkString> fFlattenableDict; |
249 | 244 |
250 private: | 245 private: |
251 bool readArray(void* value, size_t size, size_t elementSize); | 246 bool readArray(void* value, size_t size, size_t elementSize); |
252 | 247 |
253 uint32_t fFlags; | 248 uint32_t fFlags; |
254 int fVersion; | 249 int fVersion; |
255 | 250 |
256 void* fMemoryPtr; | 251 void* fMemoryPtr; |
257 | 252 |
258 SkBitmapHeapReader* fBitmapStorage; | |
259 SkTypeface** fTFArray; | 253 SkTypeface** fTFArray; |
260 int fTFCount; | 254 int fTFCount; |
261 | 255 |
262 SkFlattenable::Factory* fFactoryArray; | 256 SkFlattenable::Factory* fFactoryArray; |
263 int fFactoryCount; | 257 int fFactoryCount; |
264 | 258 |
265 // Only used if we do not have an fFactoryArray. | 259 // Only used if we do not have an fFactoryArray. |
266 SkTHashMap<SkString, SkFlattenable::Factory> fCustomFactory; | 260 SkTHashMap<SkString, SkFlattenable::Factory> fCustomFactory; |
267 | 261 |
268 SkPicture::InstallPixelRefProc fBitmapDecoder; | 262 SkPicture::InstallPixelRefProc fBitmapDecoder; |
269 | 263 |
270 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT | 264 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT |
271 // Debugging counter to keep track of how many bitmaps we | 265 // Debugging counter to keep track of how many bitmaps we |
272 // have decoded. | 266 // have decoded. |
273 int fDecodedBitmapIndex; | 267 int fDecodedBitmapIndex; |
274 #endif // DEBUG_NON_DETERMINISTIC_ASSERT | 268 #endif // DEBUG_NON_DETERMINISTIC_ASSERT |
275 }; | 269 }; |
276 | 270 |
277 #endif // SkReadBuffer_DEFINED | 271 #endif // SkReadBuffer_DEFINED |
OLD | NEW |