diff options
author | 2013-08-27 15:50:19 +0000 | |
---|---|---|
committer | 2013-08-27 15:50:19 +0000 | |
commit | d0f1a4fb28057de42d116005d82166b2302d28e9 (patch) | |
tree | 286c1a6f15981df72dcc39ddf724a47c817e2105 /src/core/SkPictureRecord.cpp | |
parent | b9168ed4324a51ae1e7263de35e54367483040d6 (diff) |
Fix clip expansion in SkPictureRecord::recordRestoreOffsetPlaceholder()
For operations which can expand the region, zeroing previous clip ops' restore offsets is not enough: we need to also break the chain - otherwise the next restore() will simply traverse back and reset the skip offsets.
R=robertphillips@google.com
Review URL: https://codereview.chromium.org/22987003
git-svn-id: http://skia.googlecode.com/svn/trunk@10934 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPictureRecord.cpp')
-rw-r--r-- | src/core/SkPictureRecord.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 01478bb844..4134f8dede 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -715,21 +715,27 @@ void SkPictureRecord::recordRestoreOffsetPlaceholder(SkRegion::Op op) { return; } + // The RestoreOffset field is initially filled with a placeholder + // value that points to the offset of the previous RestoreOffset + // in the current stack level, thus forming a linked list so that + // the restore offsets can be filled in when the corresponding + // restore command is recorded. + int32_t prevOffset = fRestoreOffsetStack.top(); + if (regionOpExpands(op)) { // Run back through any previous clip ops, and mark their offset to // be 0, disabling their ability to trigger a jump-to-restore, otherwise // they could hide this clips ability to expand the clip (i.e. go from // empty to non-empty). fillRestoreOffsetPlaceholdersForCurrentStackLevel(0); + + // Reset the pointer back to the previous clip so that subsequent + // restores don't overwrite the offsets we just cleared. + prevOffset = 0; } size_t offset = fWriter.size(); - // The RestoreOffset field is initially filled with a placeholder - // value that points to the offset of the previous RestoreOffset - // in the current stack level, thus forming a linked list so that - // the restore offsets can be filled in when the corresponding - // restore command is recorded. - addInt(fRestoreOffsetStack.top()); + addInt(prevOffset); fRestoreOffsetStack.top() = offset; } |