Index: include/core/SkPicture.h |
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h |
index e9500b25c59f01edf3608309c90a37e7edd7379d..ea3db8e7d1cea99c1e5c606833c7be101a778af4 100644 |
--- a/include/core/SkPicture.h |
+++ b/include/core/SkPicture.h |
@@ -199,6 +199,18 @@ public: |
*/ |
bool hasText() const; |
+ // A refcounted array of refcounted const SkPicture pointers. |
+ struct SnapshotArray : public SkNVRefCnt { |
+ SnapshotArray(const SkPicture* pics[], size_t count) : fPics(pics), fCount(count) {} |
+ ~SnapshotArray() { for (size_t i = 0; i < fCount; i++) { fPics[i]->unref(); } } |
+ |
+ const SkPicture* const* begin() const { return fPics; } |
+ size_t count() const { return fCount; } |
+ private: |
+ SkAutoTMalloc<const SkPicture*> fPics; |
+ size_t fCount; |
+ }; |
+ |
private: |
// V2 : adds SkPixelRef's generation ID. |
// V3 : PictInfo tag at beginning, and EOF tag at the end |
@@ -251,9 +263,8 @@ private: |
void createHeader(SkPictInfo* info) const; |
static bool IsValidPictInfo(const SkPictInfo& info); |
- // Takes ownership of the SkRecord, refs the (optional) drawablePicts and BBH. |
- SkPicture(const SkRect& cullRect, SkRecord*, SkData* drawablePicts, |
- SkBBoxHierarchy*); |
+ // Takes ownership of the SkRecord, refs the (optional) SnapshotArray and BBH. |
+ SkPicture(const SkRect& cullRect, SkRecord*, SnapshotArray*, SkBBoxHierarchy*); |
static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*); |
static SkPictureData* Backport(const SkRecord&, const SkPictInfo&, |
@@ -266,7 +277,7 @@ private: |
mutable SkTDArray<DeletionListener*> fDeletionListeners; // pointers are refed |
SkAutoTDelete<const SkRecord> fRecord; |
SkAutoTUnref<const SkBBoxHierarchy> fBBH; |
- SkAutoTUnref<SkData> fDrawablePicts; |
+ SkAutoTUnref<const SnapshotArray> fDrawablePicts; |
// helpers for fDrawablePicts |
int drawableCount() const; |