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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 SkPoint readPoint() { SkPoint p; this->readPoint(&p); return p; } | 120 SkPoint readPoint() { SkPoint p; this->readPoint(&p); return p; } |
121 virtual void readMatrix(SkMatrix* matrix); | 121 virtual void readMatrix(SkMatrix* matrix); |
122 virtual void readIRect(SkIRect* rect); | 122 virtual void readIRect(SkIRect* rect); |
123 virtual void readRect(SkRect* rect); | 123 virtual void readRect(SkRect* rect); |
124 virtual void readRegion(SkRegion* region); | 124 virtual void readRegion(SkRegion* region); |
125 | 125 |
126 virtual void readPath(SkPath* path); | 126 virtual void readPath(SkPath* path); |
127 void readPaint(SkPaint* paint) { paint->unflatten(*this); } | 127 void readPaint(SkPaint* paint) { paint->unflatten(*this); } |
128 | 128 |
129 virtual SkFlattenable* readFlattenable(SkFlattenable::Type); | 129 virtual SkFlattenable* readFlattenable(SkFlattenable::Type); |
130 template <typename T> T* readFlattenable() { | 130 template <typename T> sk_sp<T> readFlattenable() { |
131 return (T*) this->readFlattenable(T::GetFlattenableType()); | 131 return sk_sp<T>((T*)this->readFlattenable(T::GetFlattenableType())); |
132 } | 132 } |
133 sk_sp<SkColorFilter> readColorFilter() { | 133 sk_sp<SkColorFilter> readColorFilter() { return this->readFlattenable<SkColo
rFilter>(); } |
134 return sk_sp<SkColorFilter>(this->readFlattenable<SkColorFilter>()); | 134 sk_sp<SkDrawLooper> readDrawLooper() { return this->readFlattenable<SkDrawLo
oper>(); } |
135 } | 135 sk_sp<SkImageFilter> readImageFilter() { return this->readFlattenable<SkImag
eFilter>(); } |
136 sk_sp<SkDrawLooper> readDrawLooper() { | 136 sk_sp<SkMaskFilter> readMaskFilter() { return this->readFlattenable<SkMaskFi
lter>(); } |
137 return sk_sp<SkDrawLooper>(this->readFlattenable<SkDrawLooper>()); | 137 sk_sp<SkPathEffect> readPathEffect() { return this->readFlattenable<SkPathEf
fect>(); } |
138 } | 138 sk_sp<SkRasterizer> readRasterizer() { return this->readFlattenable<SkRaster
izer>(); } |
139 SkImageFilter* readImageFilter() { return this->readFlattenable<SkImageFilte
r>(); } | 139 sk_sp<SkShader> readShader() { return this->readFlattenable<SkShader>(); } |
140 SkMaskFilter* readMaskFilter() { return this->readFlattenable<SkMaskFilter
>(); } | 140 sk_sp<SkXfermode> readXfermode() { return this->readFlattenable<SkXfermode>(
); } |
141 sk_sp<SkPathEffect> readPathEffect() { | |
142 return sk_sp<SkPathEffect>(this->readFlattenable<SkPathEffect>()); | |
143 } | |
144 sk_sp<SkRasterizer> readRasterizer() { | |
145 return sk_sp<SkRasterizer>(this->readFlattenable<SkRasterizer>()); | |
146 } | |
147 sk_sp<SkShader> readShader() { return sk_sp<SkShader>(this->readFlattena
ble<SkShader>()); } | |
148 sk_sp<SkXfermode> readXfermode() { | |
149 return sk_sp<SkXfermode>(this->readFlattenable<SkXfermode>()); | |
150 } | |
151 | 141 |
152 /** | 142 /** |
153 * Like readFlattenable() but explicitly just skips the data that was writt
en for the | 143 * Like readFlattenable() but explicitly just skips the data that was writt
en for the |
154 * flattenable (or the sentinel that there wasn't one). | 144 * flattenable (or the sentinel that there wasn't one). |
155 */ | 145 */ |
156 virtual void skipFlattenable(); | 146 virtual void skipFlattenable(); |
157 | 147 |
158 // binary data and arrays | 148 // binary data and arrays |
159 virtual bool readByteArray(void* value, size_t size); | 149 virtual bool readByteArray(void* value, size_t size); |
160 virtual bool readColorArray(SkColor* colors, size_t size); | 150 virtual bool readColorArray(SkColor* colors, size_t size); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 SkPicture::InstallPixelRefProc fBitmapDecoder; | 228 SkPicture::InstallPixelRefProc fBitmapDecoder; |
239 | 229 |
240 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT | 230 #ifdef DEBUG_NON_DETERMINISTIC_ASSERT |
241 // Debugging counter to keep track of how many bitmaps we | 231 // Debugging counter to keep track of how many bitmaps we |
242 // have decoded. | 232 // have decoded. |
243 int fDecodedBitmapIndex; | 233 int fDecodedBitmapIndex; |
244 #endif // DEBUG_NON_DETERMINISTIC_ASSERT | 234 #endif // DEBUG_NON_DETERMINISTIC_ASSERT |
245 }; | 235 }; |
246 | 236 |
247 #endif // SkReadBuffer_DEFINED | 237 #endif // SkReadBuffer_DEFINED |
OLD | NEW |