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