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 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE | 13 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
14 #include "SkMatrixClipStateMgr.h" | 14 #include "SkMatrixClipStateMgr.h" |
15 #endif | 15 #endif |
16 #include "SkPathHeap.h" | 16 #include "SkPathHeap.h" |
17 #include "SkPicture.h" | 17 #include "SkPicture.h" |
18 #include "SkPictureFlat.h" | 18 #include "SkPictureFlat.h" |
19 #include "SkTemplates.h" | 19 #include "SkTemplates.h" |
20 #include "SkWriter32.h" | 20 #include "SkWriter32.h" |
21 | 21 |
22 class SkBBoxHierarchy; | 22 class SkBBoxHierarchy; |
23 class SkOffsetTable; | |
24 class SkPictureStateTree; | 23 class SkPictureStateTree; |
25 | 24 |
26 // These macros help with packing and unpacking a single byte value and | 25 // These macros help with packing and unpacking a single byte value and |
27 // a 3 byte value into/out of a uint32_t | 26 // a 3 byte value into/out of a uint32_t |
28 #define MASK_24 0x00FFFFFF | 27 #define MASK_24 0x00FFFFFF |
29 #define UNPACK_8_24(combined, small, large) \ | 28 #define UNPACK_8_24(combined, small, large) \ |
30 small = (combined >> 24) & 0xFF; \ | 29 small = (combined >> 24) & 0xFF; \ |
31 large = combined & MASK_24; | 30 large = combined & MASK_24; |
32 #define PACK_8_24(small, large) ((small << 24) | large) | 31 #define PACK_8_24(small, large) ((small << 24) | large) |
33 | 32 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 149 } |
151 | 150 |
152 void addInt(int value) { | 151 void addInt(int value) { |
153 fWriter.writeInt(value); | 152 fWriter.writeInt(value); |
154 } | 153 } |
155 void addScalar(SkScalar scalar) { | 154 void addScalar(SkScalar scalar) { |
156 fWriter.writeScalar(scalar); | 155 fWriter.writeScalar(scalar); |
157 } | 156 } |
158 | 157 |
159 // The command at 'offset' in the skp uses the specified bitmap | 158 // The command at 'offset' in the skp uses the specified bitmap |
160 void trackBitmapUse(int bitmapID, size_t offset); | |
161 int addBitmap(const SkBitmap& bitmap); | 159 int addBitmap(const SkBitmap& bitmap); |
162 void addMatrix(const SkMatrix& matrix); | 160 void addMatrix(const SkMatrix& matrix); |
163 const SkFlatData* addPaint(const SkPaint& paint) { return this->addPaintPtr(
&paint); } | 161 const SkFlatData* addPaint(const SkPaint& paint) { return this->addPaintPtr(
&paint); } |
164 const SkFlatData* addPaintPtr(const SkPaint* paint); | 162 const SkFlatData* addPaintPtr(const SkPaint* paint); |
165 void addFlatPaint(const SkFlatData* flatPaint); | 163 void addFlatPaint(const SkFlatData* flatPaint); |
166 void addPath(const SkPath& path); | 164 void addPath(const SkPath& path); |
167 void addPicture(SkPicture& picture); | 165 void addPicture(SkPicture& picture); |
168 void addPoint(const SkPoint& point); | 166 void addPoint(const SkPoint& point); |
169 void addPoints(const SkPoint pts[], int count); | 167 void addPoints(const SkPoint pts[], int count); |
170 void addRect(const SkRect& rect); | 168 void addRect(const SkRect& rect); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 SkPathHeap* fPathHeap; // reference counted | 289 SkPathHeap* fPathHeap; // reference counted |
292 SkWriter32 fWriter; | 290 SkWriter32 fWriter; |
293 | 291 |
294 // we ref each item in these arrays | 292 // we ref each item in these arrays |
295 SkTDArray<SkPicture*> fPictureRefs; | 293 SkTDArray<SkPicture*> fPictureRefs; |
296 | 294 |
297 uint32_t fRecordFlags; | 295 uint32_t fRecordFlags; |
298 bool fOptsEnabled; | 296 bool fOptsEnabled; |
299 int fInitialSaveCount; | 297 int fInitialSaveCount; |
300 | 298 |
301 SkAutoTUnref<SkOffsetTable> fBitmapUseOffsets; | |
302 | |
303 friend class SkPicturePlayback; | 299 friend class SkPicturePlayback; |
304 friend class SkPictureTester; // for unit testing | 300 friend class SkPictureTester; // for unit testing |
305 | 301 |
306 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE | 302 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
307 SkMatrixClipStateMgr fMCMgr; | 303 SkMatrixClipStateMgr fMCMgr; |
308 #endif | 304 #endif |
309 | 305 |
310 typedef SkCanvas INHERITED; | 306 typedef SkCanvas INHERITED; |
311 }; | 307 }; |
312 | 308 |
313 #endif | 309 #endif |
OLD | NEW |