aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPicturePlayback.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-19 12:26:58 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-19 12:26:58 +0000
commit821650655be1519039ae9a4a4c2e5873c02ba354 (patch)
tree8806bcdfd943fd2c0c98a78e554141ac505a2d67 /src/core/SkPicturePlayback.cpp
parent114487ceb4410302b39411695312b61d98378e16 (diff)
Ensure playing back a picture always balances saves and restores
This "fixes" the legacy interface's possible creation of pictures with unbalanced save/restores. The Android dox will need to be updated once/if this lands. R=reed@google.com, scroggo@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/286033005 git-svn-id: http://skia.googlecode.com/svn/trunk@14772 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPicturePlayback.cpp')
-rw-r--r--src/core/SkPicturePlayback.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index f2356bdeff..87cd9416ae 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -859,7 +859,8 @@ void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback)
// Record this, so we can concat w/ it if we encounter a setMatrix()
SkMatrix initialMatrix = canvas.getTotalMatrix();
- int originalSaveCount = canvas.getSaveCount();
+
+ SkAutoCanvasRestore acr(&canvas, false);
#ifdef SK_BUILD_FOR_ANDROID
fAbortCurrentPlayback = false;
@@ -871,7 +872,6 @@ void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback)
while (!reader.eof()) {
if (callback && callback->abortDrawing()) {
- canvas.restoreToCount(originalSaveCount);
return;
}
#ifdef SK_BUILD_FOR_ANDROID