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 |
11 | 11 |
12 #include "SkBitmapHeap.h" | 12 #include "SkBitmapHeap.h" |
13 #include "SkColorFilter.h" | 13 #include "SkColorFilter.h" |
14 #include "SkData.h" | 14 #include "SkData.h" |
15 #include "SkDrawLooper.h" | 15 #include "SkDrawLooper.h" |
16 #include "SkImageFilter.h" | 16 #include "SkImageFilter.h" |
17 #include "SkMaskFilter.h" | 17 #include "SkMaskFilter.h" |
18 #include "SkPath.h" | 18 #include "SkPath.h" |
19 #include "SkPathEffect.h" | 19 #include "SkPathEffect.h" |
20 #include "SkPicture.h" | 20 #include "SkPicture.h" |
21 #include "SkPixelRef.h" | 21 #include "SkPixelRef.h" |
22 #include "SkRasterizer.h" | 22 #include "SkRasterizer.h" |
23 #include "SkReadBuffer.h" | 23 #include "SkReadBuffer.h" |
24 #include "SkReader32.h" | 24 #include "SkReader32.h" |
25 #include "SkRefCnt.h" | 25 #include "SkRefCnt.h" |
26 #include "SkShader.h" | 26 #include "SkShader.h" |
27 #include "SkUnitMapper.h" | |
28 #include "SkWriteBuffer.h" | 27 #include "SkWriteBuffer.h" |
29 #include "SkXfermode.h" | 28 #include "SkXfermode.h" |
30 | 29 |
31 class SkBitmap; | 30 class SkBitmap; |
32 | 31 |
33 #if defined(SK_DEBUG) && defined(SK_BUILD_FOR_MAC) | 32 #if defined(SK_DEBUG) && defined(SK_BUILD_FOR_MAC) |
34 #define DEBUG_NON_DETERMINISTIC_ASSERT | 33 #define DEBUG_NON_DETERMINISTIC_ASSERT |
35 #endif | 34 #endif |
36 | 35 |
37 class SkReadBuffer { | 36 class SkReadBuffer { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 return (T*) this->readFlattenable(T::GetFlattenableType()); | 102 return (T*) this->readFlattenable(T::GetFlattenableType()); |
104 } | 103 } |
105 SkColorFilter* readColorFilter() { return this->readFlattenable<SkColorFilte
r>(); } | 104 SkColorFilter* readColorFilter() { return this->readFlattenable<SkColorFilte
r>(); } |
106 SkDrawLooper* readDrawLooper() { return this->readFlattenable<SkDrawLooper
>(); } | 105 SkDrawLooper* readDrawLooper() { return this->readFlattenable<SkDrawLooper
>(); } |
107 SkImageFilter* readImageFilter() { return this->readFlattenable<SkImageFilte
r>(); } | 106 SkImageFilter* readImageFilter() { return this->readFlattenable<SkImageFilte
r>(); } |
108 SkMaskFilter* readMaskFilter() { return this->readFlattenable<SkMaskFilter
>(); } | 107 SkMaskFilter* readMaskFilter() { return this->readFlattenable<SkMaskFilter
>(); } |
109 SkPathEffect* readPathEffect() { return this->readFlattenable<SkPathEffect
>(); } | 108 SkPathEffect* readPathEffect() { return this->readFlattenable<SkPathEffect
>(); } |
110 SkPixelRef* readPixelRef() { return this->readFlattenable<SkPixelRef>(
); } | 109 SkPixelRef* readPixelRef() { return this->readFlattenable<SkPixelRef>(
); } |
111 SkRasterizer* readRasterizer() { return this->readFlattenable<SkRasterizer
>(); } | 110 SkRasterizer* readRasterizer() { return this->readFlattenable<SkRasterizer
>(); } |
112 SkShader* readShader() { return this->readFlattenable<SkShader>();
} | 111 SkShader* readShader() { return this->readFlattenable<SkShader>();
} |
113 SkUnitMapper* readUnitMapper() { return this->readFlattenable<SkUnitMapper
>(); } | |
114 SkXfermode* readXfermode() { return this->readFlattenable<SkXfermode>(
); } | 112 SkXfermode* readXfermode() { return this->readFlattenable<SkXfermode>(
); } |
115 | 113 |
| 114 /** |
| 115 * Like readFlattenable() but explicitly just skips the data that was writt
en for the |
| 116 * flattenable (or the sentinel that there wasn't one). |
| 117 */ |
| 118 virtual void skipFlattenable(); |
116 | 119 |
117 // binary data and arrays | 120 // binary data and arrays |
118 virtual bool readByteArray(void* value, size_t size); | 121 virtual bool readByteArray(void* value, size_t size); |
119 virtual bool readColorArray(SkColor* colors, size_t size); | 122 virtual bool readColorArray(SkColor* colors, size_t size); |
120 virtual bool readIntArray(int32_t* values, size_t size); | 123 virtual bool readIntArray(int32_t* values, size_t size); |
121 virtual bool readPointArray(SkPoint* points, size_t size); | 124 virtual bool readPointArray(SkPoint* points, size_t size); |
122 virtual bool readScalarArray(SkScalar* values, size_t size); | 125 virtual bool readScalarArray(SkScalar* values, size_t size); |
123 | 126 |
124 SkData* readByteArrayAsData() { | 127 SkData* readByteArrayAsData() { |
125 size_t len = this->getArrayCount(); | 128 size_t len = this->getArrayCount(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 SkPicture::InstallPixelRefProc fBitmapDecoder; | 206 SkPicture::InstallPixelRefProc fBitmapDecoder; |
204 | 207 |
205 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT | 208 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT |
206 // Debugging counter to keep track of how many bitmaps we | 209 // Debugging counter to keep track of how many bitmaps we |
207 // have decoded. | 210 // have decoded. |
208 int fDecodedBitmapIndex; | 211 int fDecodedBitmapIndex; |
209 #endif // DEBUG_NON_DETERMINISTIC_ASSERT | 212 #endif // DEBUG_NON_DETERMINISTIC_ASSERT |
210 }; | 213 }; |
211 | 214 |
212 #endif // SkReadBuffer_DEFINED | 215 #endif // SkReadBuffer_DEFINED |
OLD | NEW |