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

Unified Diff: include/core/SkPicture.h

Issue 746553002: SkData -> SkPicture::SnapshotArray (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: ctor 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') | no next file with comments »
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 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;
« no previous file with comments | « no previous file | src/core/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698