SkAutoCanvasRestore Reference === ---
class SkAutoCanvasRestore {

    SkAutoCanvasRestore(SkCanvas* canvas, bool doSave);
    ~SkAutoCanvasRestore();
    void restore();
};

Stack helper class calls SkCanvas::restoreToCount when SkAutoCanvasRestore goes out of scope. Use this to guarantee that the canvas is restored to a known state. ---
SkAutoCanvasRestore(SkCanvas* canvas, bool doSave)
Preserves SkCanvas::save() count. Optionally saves SkCanvas clip and SkCanvas matrix. ### Parameters
canvas SkCanvas to guard
doSave call SkCanvas::save()
### Return Value utility to restore SkCanvas state on destructor ### Example
### See Also SkCanvas::save SkCanvas::restore ---
~SkAutoCanvasRestore()
Restores SkCanvas to saved state. Destructor is called when container goes out of scope. ### See Also SkCanvas::save SkCanvas::restore ---
void restore()
Restores SkCanvas to saved state immediately. Subsequent calls and ~SkAutoCanvasRestore() have no effect. ### Example
#### Example Output ~~~~ saveCanvas: false before restore: 2 saveCanvas: false after restore: 2 saveCanvas: true before restore: 2 saveCanvas: true after restore: 2 saveCanvas: false before restore: 2 saveCanvas: false after restore: 1 saveCanvas: true before restore: 2 saveCanvas: true after restore: 1 final count: 1 ~~~~
### See Also SkCanvas::save SkCanvas::restore