Also check in work in progress for blend modes, round rects, and a placeholder for pictures. One minor include change to add a parameter name for SkBlendMode function. TBR=reed@google.com R=caryclark@google.com Docs-Preview: https://skia.org/?cl=134200 Bug: skia:6898 Change-Id: I5d2a9221d61edb32d9c7edbb3193401605b2b513 Reviewed-on: https://skia-review.googlesource.com/134200 Reviewed-by: Cary Clark <caryclark@google.com> Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org> Auto-Submit: Cary Clark <caryclark@skia.org>
5.7 KiB
SkAutoCanvasRestore Reference
Automatic Canvas Restore
Class SkAutoCanvasRestore
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.
Overview
Topic | Description |
---|---|
Constructors | functions that construct SkAutoCanvasRestore |
Functions | global and class member functions |
Constructor
SkAutoCanvasRestore can be constructed or initialized by these functions, including C++ class constructors.
Topic | Description |
---|---|
SkAutoCanvasRestore(SkCanvas* canvas, bool doSave) | preserves Canvas save count |
~SkAutoCanvasRestore() | restores Canvas to saved state |
Member Function
SkAutoCanvasRestore member functions read and modify the structure properties.
Topic | Description |
---|---|
restore | restores Canvas to saved state |
SkAutoCanvasRestore
SkAutoCanvasRestore(SkCanvas* canvas, bool doSave)
Preserves Canvas save count. Optionally saves Canvas Clip and Canvas Matrix.
Parameters
canvas |
Canvas to guard |
doSave |
call SkCanvas::save() |
Return Value
utility to restore Canvas state on destructor
Example
See Also
SkCanvas::save SkCanvas::restore
~SkAutoCanvasRestore
~SkAutoCanvasRestore()
Restores Canvas to saved state. Destructor is called when container goes out of scope.
See Also
SkCanvas::save SkCanvas::restore
restore
void restore()
Restores Canvas 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