diff options
author | 2012-08-29 18:52:07 +0000 | |
---|---|---|
committer | 2012-08-29 18:52:07 +0000 | |
commit | c9ab987efcb7e8b69237d565f73c28c137610232 (patch) | |
tree | 47a90504ac910f9e58d55081a3088b5432fd9ce6 /src/core/SkPictureRecord.cpp | |
parent | b947b91794f47cc92b17c83e570536f5e315a118 (diff) |
Implement multi-threaded picture playback via cloning.
The CL adds SkPicture.clone() which produces a thread-safe copy by
creating a shallow copy of the thread-safe data within the picture and
a deep copy of the data that is not (e.g. SkPaint). This implementation
re-flattens the paints when cloning instead of retaining the flattened
paints from the recording process.
Changes were also needed to various classes to ensure thread safety
Review URL: https://codereview.appspot.com/6459105
git-svn-id: http://skia.googlecode.com/svn/trunk@5335 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPictureRecord.cpp')
-rw-r--r-- | src/core/SkPictureRecord.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 3d124c4882..afa2debc0d 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -31,12 +31,14 @@ SkPictureRecord::SkPictureRecord(uint32_t flags) : fRestoreOffsetStack.setReserve(32); fInitialSaveCount = kNoInitialSave; - fFlattenableHeap.setBitmapStorage(&fBitmapHeap); + fBitmapHeap = SkNEW(SkBitmapHeap); + fFlattenableHeap.setBitmapStorage(fBitmapHeap); fPathHeap = NULL; // lazy allocate fFirstSavedLayerIndex = kNoSavedLayerIndex; } SkPictureRecord::~SkPictureRecord() { + SkSafeUnref(fBitmapHeap); SkSafeUnref(fPathHeap); fFlattenableHeap.setBitmapStorage(NULL); fPictureRefs.unrefAll(); @@ -521,7 +523,7 @@ void SkPictureRecord::drawData(const void* data, size_t length) { /////////////////////////////////////////////////////////////////////////////// void SkPictureRecord::addBitmap(const SkBitmap& bitmap) { - addInt(fBitmapHeap.insert(bitmap)); + addInt(fBitmapHeap->insert(bitmap)); } void SkPictureRecord::addMatrix(const SkMatrix& matrix) { |