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 SkPictureRecord_DEFINED | 8 #ifndef SkPictureRecord_DEFINED |
9 #define SkPictureRecord_DEFINED | 9 #define SkPictureRecord_DEFINED |
10 | 10 |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkFlattenable.h" | 12 #include "SkFlattenable.h" |
13 #include "SkPicture.h" | 13 #include "SkPicture.h" |
14 #include "SkPictureData.h" | 14 #include "SkPictureData.h" |
15 #include "SkTArray.h" | 15 #include "SkTArray.h" |
16 #include "SkTDArray.h" | 16 #include "SkTDArray.h" |
| 17 #include "SkTHash.h" |
17 #include "SkWriter32.h" | 18 #include "SkWriter32.h" |
18 | 19 |
19 // These macros help with packing and unpacking a single byte value and | 20 // These macros help with packing and unpacking a single byte value and |
20 // a 3 byte value into/out of a uint32_t | 21 // a 3 byte value into/out of a uint32_t |
21 #define MASK_24 0x00FFFFFF | 22 #define MASK_24 0x00FFFFFF |
22 #define UNPACK_8_24(combined, small, large) \ | 23 #define UNPACK_8_24(combined, small, large) \ |
23 small = (combined >> 24) & 0xFF; \ | 24 small = (combined >> 24) & 0xFF; \ |
24 large = combined & MASK_24; | 25 large = combined & MASK_24; |
25 #define PACK_8_24(small, large) ((small << 24) | large) | 26 #define PACK_8_24(small, large) ((small << 24) | large) |
26 | 27 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 size_t recordClipRegion(const SkRegion& region, SkRegion::Op op); | 220 size_t recordClipRegion(const SkRegion& region, SkRegion::Op op); |
220 void recordSave(); | 221 void recordSave(); |
221 void recordSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags f
lags); | 222 void recordSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags f
lags); |
222 void recordRestore(bool fillInSkips = true); | 223 void recordRestore(bool fillInSkips = true); |
223 | 224 |
224 private: | 225 private: |
225 SkPictureContentInfo fContentInfo; | 226 SkPictureContentInfo fContentInfo; |
226 | 227 |
227 SkTArray<SkBitmap> fBitmaps; | 228 SkTArray<SkBitmap> fBitmaps; |
228 SkTArray<SkPaint> fPaints; | 229 SkTArray<SkPaint> fPaints; |
229 SkTArray<SkPath> fPaths; | 230 |
| 231 struct PathHash { |
| 232 uint32_t operator()(const SkPath& p) { return p.getGenerationID(); } |
| 233 }; |
| 234 SkTHashMap<SkPath, int, PathHash> fPaths; |
230 | 235 |
231 SkWriter32 fWriter; | 236 SkWriter32 fWriter; |
232 | 237 |
233 // we ref each item in these arrays | 238 // we ref each item in these arrays |
234 SkTDArray<const SkImage*> fImageRefs; | 239 SkTDArray<const SkImage*> fImageRefs; |
235 SkTDArray<const SkPicture*> fPictureRefs; | 240 SkTDArray<const SkPicture*> fPictureRefs; |
236 SkTDArray<const SkTextBlob*> fTextBlobRefs; | 241 SkTDArray<const SkTextBlob*> fTextBlobRefs; |
237 | 242 |
238 uint32_t fRecordFlags; | 243 uint32_t fRecordFlags; |
239 int fInitialSaveCount; | 244 int fInitialSaveCount; |
240 | 245 |
241 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor | 246 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor |
242 | 247 |
243 typedef SkCanvas INHERITED; | 248 typedef SkCanvas INHERITED; |
244 }; | 249 }; |
245 | 250 |
246 #endif | 251 #endif |
OLD | NEW |