add restore() to SkAutoCanvasRestore

git-svn-id: http://skia.googlecode.com/svn/trunk@6505 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2012-11-20 15:12:21 +00:00
parent 7ba591eb7a
commit f6c9a5ba5c

View File

@ -1085,7 +1085,20 @@ public:
}
}
~SkAutoCanvasRestore() {
fCanvas->restoreToCount(fSaveCount);
if (fCanvas) {
fCanvas->restoreToCount(fSaveCount);
}
}
/**
* Perform the restore now, instead of waiting for the destructor. Will
* only do this once.
*/
void restore() {
if (fCanvas) {
fCanvas->restoreToCount(fSaveCount);
fCanvas = NULL;
}
}
private: