aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPictureRecord.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkPictureRecord.cpp')
-rw-r--r--src/core/SkPictureRecord.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index b908670baf..5c00ab9bfe 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -49,18 +49,20 @@ int SkPictureRecord::saveLayer(const SkRect* bounds, const SkPaint* paint,
}
void SkPictureRecord::restore() {
-
+ // check for underflow
+ if (fRestoreOffsetStack.count() == 0) {
+ return;
+ }
+
// patch up the clip offsets
- {
- uint32_t restoreOffset = (uint32_t)fWriter.size();
- uint32_t offset = fRestoreOffsetStack.top();
- while (offset) {
- uint32_t* peek = fWriter.peek32(offset);
- offset = *peek;
- *peek = restoreOffset;
- }
- fRestoreOffsetStack.pop();
+ uint32_t restoreOffset = (uint32_t)fWriter.size();
+ uint32_t offset = fRestoreOffsetStack.top();
+ while (offset) {
+ uint32_t* peek = fWriter.peek32(offset);
+ offset = *peek;
+ *peek = restoreOffset;
}
+ fRestoreOffsetStack.pop();
addDraw(RESTORE);
validate();