skia2/site/user/api/SkAutoCanvasRestore_Reference.md
Cary Clark 4855f78dd1 fix bookmaker nightly
- mark the interfaces that use SkMask as deprecated
- add more autogenerated subtopics
- make subtopic names singular, avoiding collision with Skia names
- simplify #Deprecated and #Bug tags
- add "#Deprecated soon" to note things to be deprecated
- fix some spelling errors
- refresh web docs
- add self-check functionality to find methods outside subtopics

TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=102150
Bug: skia:6898
Change-Id: I0e742a56d49dccd4409bb68eed9167c8ad7611ce
Reviewed-on: https://skia-review.googlesource.com/102150
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-02-06 15:20:25 +00:00

3.6 KiB

SkAutoCanvasRestore Reference

Automatic Canvas Restore

Overview

Subtopic

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

Class SkAutoCanvasRestore

Stack helper class calls

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