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 "SkTemplates.h" | 15 #include "SkTArray.h" |
| 16 #include "SkTDArray.h" |
16 #include "SkWriter32.h" | 17 #include "SkWriter32.h" |
17 | 18 |
18 // These macros help with packing and unpacking a single byte value and | 19 // These macros help with packing and unpacking a single byte value and |
19 // a 3 byte value into/out of a uint32_t | 20 // a 3 byte value into/out of a uint32_t |
20 #define MASK_24 0x00FFFFFF | 21 #define MASK_24 0x00FFFFFF |
21 #define UNPACK_8_24(combined, small, large) \ | 22 #define UNPACK_8_24(combined, small, large) \ |
22 small = (combined >> 24) & 0xFF; \ | 23 small = (combined >> 24) & 0xFF; \ |
23 large = combined & MASK_24; | 24 large = combined & MASK_24; |
24 #define PACK_8_24(small, large) ((small << 24) | large) | 25 #define PACK_8_24(small, large) ((small << 24) | large) |
25 | 26 |
26 | 27 |
27 class SkPictureRecord : public SkCanvas { | 28 class SkPictureRecord : public SkCanvas { |
28 public: | 29 public: |
29 SkPictureRecord(const SkISize& dimensions, uint32_t recordFlags); | 30 SkPictureRecord(const SkISize& dimensions, uint32_t recordFlags); |
30 virtual ~SkPictureRecord(); | 31 virtual ~SkPictureRecord(); |
31 | 32 |
32 const SkTDArray<const SkPicture* >& getPictureRefs() const { | 33 const SkTDArray<const SkPicture* >& getPictureRefs() const { |
33 return fPictureRefs; | 34 return fPictureRefs; |
34 } | 35 } |
35 | 36 |
36 const SkTDArray<const SkTextBlob* >& getTextBlobRefs() const { | 37 const SkTDArray<const SkTextBlob* >& getTextBlobRefs() const { |
37 return fTextBlobRefs; | 38 return fTextBlobRefs; |
38 } | 39 } |
39 | 40 |
40 const SkTDArray<const SkImage* >& getImageRefs() const { | 41 const SkTDArray<const SkImage* >& getImageRefs() const { |
41 return fImageRefs; | 42 return fImageRefs; |
42 } | 43 } |
43 | 44 |
44 SkData* opData(bool deepCopy) const { | 45 SkData* opData(bool deepCopy) const { |
45 this->validate(fWriter.bytesWritten(), 0); | 46 this->validate(fWriter.bytesWritten(), 0); |
46 | 47 |
47 if (fWriter.bytesWritten() == 0) { | 48 if (fWriter.bytesWritten() == 0) { |
48 return SkData::NewEmpty(); | 49 return SkData::NewEmpty(); |
49 } | 50 } |
50 | 51 |
51 if (deepCopy) { | 52 if (deepCopy) { |
52 return SkData::NewWithCopy(fWriter.contiguousArray(), fWriter.bytesW
ritten()); | 53 return SkData::NewWithCopy(fWriter.contiguousArray(), fWriter.bytesW
ritten()); |
53 } | 54 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 237 |
237 uint32_t fRecordFlags; | 238 uint32_t fRecordFlags; |
238 int fInitialSaveCount; | 239 int fInitialSaveCount; |
239 | 240 |
240 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor | 241 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor |
241 | 242 |
242 typedef SkCanvas INHERITED; | 243 typedef SkCanvas INHERITED; |
243 }; | 244 }; |
244 | 245 |
245 #endif | 246 #endif |
OLD | NEW |