aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-11-21 12:20:35 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-21 12:20:35 -0800
commit19ac76753ec9f71a8eb0b58cf0450fd4e59f2a7c (patch)
treea0339362bfbd61c0c7896e65aef858362b61762f
parent179465150939c2f2420bfc15dc33825b1130e7f7 (diff)
SkPicture::SnapshotArray doesn't really stand to benefit from refcounting.
-rw-r--r--include/core/SkPicture.h9
-rw-r--r--src/core/SkPicture.cpp2
-rw-r--r--src/core/SkPictureRecorder.cpp2
3 files changed, 7 insertions, 6 deletions
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index d5c07a37d3..4db64bf93d 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -199,8 +199,9 @@ public:
*/
bool hasText() const;
- // A refcounted array of refcounted const SkPicture pointers.
- struct SnapshotArray : public SkNVRefCnt<SnapshotArray> {
+ // An array of refcounted const SkPicture pointers.
+ class SnapshotArray : ::SkNoncopyable {
+ public:
SnapshotArray(const SkPicture* pics[], size_t count) : fPics(pics), fCount(count) {}
~SnapshotArray() { for (size_t i = 0; i < fCount; i++) { fPics[i]->unref(); } }
@@ -263,7 +264,7 @@ private:
void createHeader(SkPictInfo* info) const;
static bool IsValidPictInfo(const SkPictInfo& info);
- // Takes ownership of the SkRecord, refs the (optional) SnapshotArray and BBH.
+ // Takes ownership of the SkRecord and (optional) SnapshotArray, refs the (optional) BBH.
SkPicture(const SkRect& cullRect, SkRecord*, SnapshotArray*, SkBBoxHierarchy*);
static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*);
@@ -277,7 +278,7 @@ private:
mutable SkTDArray<DeletionListener*> fDeletionListeners; // pointers are refed
SkAutoTDelete<const SkRecord> fRecord;
SkAutoTUnref<const SkBBoxHierarchy> fBBH;
- SkAutoTUnref<const SnapshotArray> fDrawablePicts;
+ SkAutoTDelete<const SnapshotArray> fDrawablePicts;
// helpers for fDrawablePicts
int drawableCount() const;
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index a8e160f855..b24f7196d0 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -523,7 +523,7 @@ SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr
, fCullRect(cullRect)
, fRecord(record)
, fBBH(SkSafeRef(bbh))
- , fDrawablePicts(SkSafeRef(drawablePicts))
+ , fDrawablePicts(drawablePicts)
, fAnalysis(*fRecord)
{}
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp
index edee07b0e3..3262938ed1 100644
--- a/src/core/SkPictureRecorder.cpp
+++ b/src/core/SkPictureRecorder.cpp
@@ -61,7 +61,7 @@ SkPicture* SkPictureRecorder::endRecording() {
// TODO: we should remember these from our caller
SkBBHFactory* factory = NULL;
uint32_t recordFlags = 0;
- SkAutoTUnref<SkPicture::SnapshotArray> drawablePicts(
+ SkAutoTDelete<SkPicture::SnapshotArray> drawablePicts(
fRecorder->newDrawableSnapshot(factory, recordFlags));
SkPicture* pict = SkNEW_ARGS(SkPicture, (fCullRect, fRecord.detach(),
drawablePicts.detach(), fBBH.get()));