Skia
2D Graphics Library
SkAutoCanvasRestore Class Reference

Stack helper class calls SkCanvas::restoreToCount when SkAutoCanvasRestore goes out of scope. More...

#include <SkCanvas.h>

Public Member Functions

 SkAutoCanvasRestore (SkCanvas *canvas, bool doSave)
 Preserves SkCanvas::save() count. More...
 
 ~SkAutoCanvasRestore ()
 Restores SkCanvas to saved state. More...
 
void restore ()
 Restores SkCanvas to saved state immediately. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SkAutoCanvasRestore()

SkAutoCanvasRestore::SkAutoCanvasRestore ( SkCanvas canvas,
bool  doSave 
)
inline

Preserves SkCanvas::save() count.

Optionally saves SkCanvas clip and SkCanvas matrix.

Parameters
canvasSkCanvas to guard
doSavecall SkCanvas::save()
Returns
utility to restore SkCanvas state on destructor

◆ ~SkAutoCanvasRestore()

SkAutoCanvasRestore::~SkAutoCanvasRestore ( )
inline

Restores SkCanvas to saved state.

Destructor is called when container goes out of scope.

Member Function Documentation

◆ restore()

void SkAutoCanvasRestore::restore ( )
inline

Restores SkCanvas to saved state immediately.

Subsequent calls and ~SkAutoCanvasRestore() have no effect.


The documentation for this class was generated from the following file: