skia2/site/user/api/SkAutoCanvasRestore_Reference.md
Cary Clark 186d08f621 fix bugs exposed by documenting SkImageInfo
- More rigorous symbol identification creates additional
links, and finds spurious errors like unnecessary
parentheses.

- Fixed code to allow preprocessor directives in
#Code blocks (still more to do).

- Fixed examples waiting on fiddle updates.

- Make SkImageInfo officially documented (update in status.json).

- Fixed enum indentation.



Docs-Preview: https://skia.org/?cl=115656
Bug: skia:6898
Change-Id: Ifcf5cfd3f6c03b3b83155c898b2b035a2f3d443c
Reviewed-on: https://skia-review.googlesource.com/115656
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-04-03 16:09:56 +00:00

3.9 KiB

SkAutoCanvasRestore Reference

Automatic Canvas Restore

Overview

Overview Subtopic

name description
Constructor functions that construct SkAutoCanvasRestore
Member Function static functions and member methods

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.

Constructor

name description
SkAutoCanvasRestore(SkCanvas* canvas, bool doSave) preserves Canvas save count
~SkAutoCanvasRestore() restores Canvas to saved state

Member Function

name 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