Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: include/core/SkPicture.h

Issue 746553002: SkData -> SkPicture::SnapshotArray (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: or ref'd Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkPicture.cpp » ('j') | src/core/SkRecorder.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPicture.h
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index dc522a5c9d9229c771041e5c7a1c98bd0fdfc3da..6f9624ea7504d8cb11c95e56e7e55c310091c05b 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -202,6 +202,19 @@ public:
*/
bool hasText() const;
+ // A refcounted array of refcounted const SkPicture pointers.
+ struct SnapshotArray : public SkNVRefCnt {
+ explicit SnapshotArray(size_t count) { fArray.setCount(count); }
+ ~SnapshotArray() { fArray.unrefAll(); }
+
+ const SkPicture*& operator[](size_t i) { return fArray[i]; }
reed1 2014/11/20 20:36:47 this looks tricky, since it allows the receiver to
mtklein 2014/11/21 16:03:50 Went with set(). I don't think we can assert sing
+ const SkPicture* operator[](size_t i) const { return fArray[i]; }
+ size_t count() const { return fArray.count(); }
+ const SkPicture* const* begin() const { return fArray.begin(); }
+ private:
+ SkTDArray<const SkPicture*> fArray;
+ };
+
private:
// V2 : adds SkPixelRef's generation ID.
// V3 : PictInfo tag at beginning, and EOF tag at the end
@@ -255,9 +268,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&,
@@ -270,7 +282,7 @@ private:
mutable SkTDArray<DeletionListener*> fDeletionListeners; // pointers are refed
SkAutoTDelete<SkRecord> fRecord;
SkAutoTUnref<SkBBoxHierarchy> fBBH;
- SkAutoTUnref<SkData> fDrawablePicts;
+ SkAutoTUnref<SnapshotArray> fDrawablePicts;
// helpers for fDrawablePicts
int drawableCount() const;
« no previous file with comments | « no previous file | src/core/SkPicture.cpp » ('j') | src/core/SkRecorder.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698