skia2/site/user/api/SkAutoCanvasRestore_Reference.md
Cary Clark cb6bef0ad5 Update bookmaker
- This update includes font documentation.
SkFont_Reference.bmh was generated by running:

  bookmaker -b docs -i include/core/SkFont.h -t

This creates a placeholder
for examples and additional documentation.

- More work done to exclude experimental/private
symbols.

Symbols that include "experimental_", "legacy_",
"private_", "temporary_", "deprecated_" as part
of their name (case-insensitive) are not
referenced by the on-line docs and don't need
comments.

Tables built for online only include public symbols.

- Better links for constructors, destructors, operators
- Fixed some minor public interfaces
- Removed _const crutch on operators
- Keep includes inside 100 columns

TBR=reed@google.com

Docs-Preview: https://skia.org/?cl=171900
Bug: skia:
Change-Id: I93b229c6625d800604671e05b82a14c06cb906d2
Reviewed-on: https://skia-review.googlesource.com/c/171900
Reviewed-by: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
2018-11-29 18:17:30 +00:00

3.8 KiB

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