Index: src/core/SkPictureRecord.cpp |
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp |
index 2c2d334caf02d03dd3ee831550d851c4cccf2d22..33071ee6a07554c1ff223214978dccb72512d20b 100644 |
--- a/src/core/SkPictureRecord.cpp |
+++ b/src/core/SkPictureRecord.cpp |
@@ -715,21 +715,28 @@ 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); |
+ |
robertphillips
2013/08/27 15:08:56
Reset the pointer back to the previous clip so tha
|
+ // Avoid linking to the previous RestoreOffset - otherwise a |
+ // subsequent restore() will simply 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; |
} |