diff options
author | junov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-07-12 17:47:34 +0000 |
---|---|---|
committer | junov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-07-12 17:47:34 +0000 |
commit | a6c9e0e02be390d36b80f4872c628edb3594208e (patch) | |
tree | be0b06be5e8f496fa93848db891889afb9ae99a3 /src/core | |
parent | d0c1a06cb98dd4a009dfa79e37ba6ca23a8c180b (diff) |
Cleanup restore offsets at end of SkPicture recording
Review URL: http://codereview.appspot.com/6355099/
TEST=skia unit test CanvasTest, test step TwoClipOps
BUG=https://code.google.com/p/chromium/issues/detail?id=133432
git-svn-id: http://skia.googlecode.com/svn/trunk@4577 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkPicture.cpp | 1 | ||||
-rw-r--r-- | src/core/SkPictureRecord.cpp | 8 | ||||
-rw-r--r-- | src/core/SkPictureRecord.h | 2 |
3 files changed, 11 insertions, 0 deletions
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp index 350784577a..58098e7bfc 100644 --- a/src/core/SkPicture.cpp +++ b/src/core/SkPicture.cpp @@ -180,6 +180,7 @@ SkCanvas* SkPicture::getRecordingCanvas() const { void SkPicture::endRecording() { if (NULL == fPlayback) { if (NULL != fRecord) { + fRecord->endRecording(); fPlayback = SkNEW_ARGS(SkPicturePlayback, (*fRecord)); fRecord->unref(); fRecord = NULL; diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index f961bc4c62..630a1bb649 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -170,6 +170,14 @@ void SkPictureRecord::fillRestoreOffsetPlaceholdersForCurrentStackLevel( } } +void SkPictureRecord::endRecording() { + // clear any remaining unhandled restore offset placeholders + while (fRestoreOffsetStack.count()) { + this->fillRestoreOffsetPlaceholdersForCurrentStackLevel(0); + fRestoreOffsetStack.pop(); + } +} + void SkPictureRecord::recordRestoreOffsetPlaceholder(SkRegion::Op op) { if (regionOpExpands(op)) { // Run back through any previous clip ops, and mark their offset to diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h index 7e5f086c7b..c970696f18 100644 --- a/src/core/SkPictureRecord.h +++ b/src/core/SkPictureRecord.h @@ -95,6 +95,8 @@ public: } bool shouldFlattenPixels(const SkBitmap&) const; + + void endRecording(); private: struct PixelRefDictionaryEntry { uint32_t fKey; // SkPixelRef GenerationID. |