From 821650655be1519039ae9a4a4c2e5873c02ba354 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Mon, 19 May 2014 12:26:58 +0000 Subject: 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 --- src/core/SkPicturePlayback.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/SkPicturePlayback.cpp') 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 -- cgit v1.2.3