2018-01-22 12:55:48 +00:00
|
|
|
SkAutoCanvasRestore Reference
|
|
|
|
===
|
|
|
|
|
|
|
|
# <a name="Automatic_Canvas_Restore"></a> Automatic Canvas Restore
|
|
|
|
|
2018-02-01 14:37:32 +00:00
|
|
|
## <a name="Overview"></a> Overview
|
2018-01-22 12:55:48 +00:00
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
## <a name="Subtopic"></a> Subtopic
|
2018-01-22 12:55:48 +00:00
|
|
|
|
|
|
|
| name | description |
|
2018-02-01 14:37:32 +00:00
|
|
|
| --- | --- |
|
2018-02-06 14:41:53 +00:00
|
|
|
| <a href="SkAutoCanvasRestore_Reference#Automatic_Canvas_Restore_Constructor">Constructor</a> | functions that construct <a href="SkAutoCanvasRestore_Reference#SkAutoCanvasRestore">SkAutoCanvasRestore</a> |
|
|
|
|
| <a href="SkAutoCanvasRestore_Reference#Automatic_Canvas_Restore_Member_Function">Member Function</a> | static functions and member methods |
|
2018-02-01 14:37:32 +00:00
|
|
|
|
|
|
|
# <a name="SkAutoCanvasRestore"></a> Class SkAutoCanvasRestore
|
|
|
|
Stack helper class calls
|
2018-01-22 12:55:48 +00:00
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
## <a name="Constructor"></a> Constructor
|
2018-01-22 12:55:48 +00:00
|
|
|
|
|
|
|
| name | description |
|
2018-02-01 14:37:32 +00:00
|
|
|
| --- | --- |
|
2018-01-30 15:08:57 +00:00
|
|
|
| <a href="#SkAutoCanvasRestore_SkCanvas_star">SkAutoCanvasRestore(SkCanvas* canvas, bool doSave)</a> | preserves <a href="SkCanvas_Reference#Canvas">Canvas</a> save count |
|
2018-02-01 14:37:32 +00:00
|
|
|
| <a href="#SkAutoCanvasRestore_destructor">~SkAutoCanvasRestore()</a> | restores <a href="SkCanvas_Reference#Canvas">Canvas</a> to saved state |
|
2018-01-22 12:55:48 +00:00
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
## <a name="Member_Function"></a> Member Function
|
2018-01-22 12:55:48 +00:00
|
|
|
|
|
|
|
| name | description |
|
2018-02-01 14:37:32 +00:00
|
|
|
| --- | --- |
|
2018-01-30 15:08:57 +00:00
|
|
|
| <a href="#SkAutoCanvasRestore_restore">restore</a> | restores <a href="SkCanvas_Reference#Canvas">Canvas</a> to saved state |
|
2018-01-22 12:55:48 +00:00
|
|
|
|
|
|
|
<a name="SkAutoCanvasRestore_SkCanvas_star"></a>
|
|
|
|
## SkAutoCanvasRestore
|
|
|
|
|
|
|
|
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
|
|
|
SkAutoCanvasRestore(SkCanvas* canvas, bool doSave)
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
Preserves <a href="SkCanvas_Reference#Canvas">Canvas</a> save count. Optionally saves <a href="#Clip">Canvas Clip</a> and <a href="#Matrix">Canvas Matrix</a>.
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
<table> <tr> <td><a name="SkAutoCanvasRestore_SkCanvas_star_canvas"> <code><strong>canvas </strong></code> </a></td> <td>
|
|
|
|
<a href="SkCanvas_Reference#Canvas">Canvas</a> to guard</td>
|
|
|
|
</tr> <tr> <td><a name="SkAutoCanvasRestore_SkCanvas_star_doSave"> <code><strong>doSave </strong></code> </a></td> <td>
|
|
|
|
call <a href="#SkCanvas_save">SkCanvas::save()</a></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
### Return Value
|
|
|
|
|
2018-01-26 17:56:22 +00:00
|
|
|
utility to restore <a href="SkCanvas_Reference#Canvas">Canvas</a> state on destructor
|
2018-01-22 12:55:48 +00:00
|
|
|
|
|
|
|
### Example
|
|
|
|
|
|
|
|
<div><fiddle-embed name="466ef576b88e29d7252422db7adeed1c"></fiddle-embed></div>
|
|
|
|
|
|
|
|
### See Also
|
|
|
|
|
|
|
|
<a href="#SkCanvas_save">SkCanvas::save</a> <a href="#SkCanvas_restore">SkCanvas::restore</a>
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
<a name="SkAutoCanvasRestore_destructor"></a>
|
|
|
|
## ~SkAutoCanvasRestore
|
|
|
|
|
|
|
|
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
|
|
|
~SkAutoCanvasRestore()
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
Restores <a href="SkCanvas_Reference#Canvas">Canvas</a> to saved state. Destructor is called when container goes out of
|
|
|
|
scope.
|
|
|
|
|
|
|
|
### See Also
|
|
|
|
|
|
|
|
<a href="#SkCanvas_save">SkCanvas::save</a> <a href="#SkCanvas_restore">SkCanvas::restore</a>
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
<a name="SkAutoCanvasRestore_restore"></a>
|
|
|
|
## restore
|
|
|
|
|
|
|
|
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
|
|
|
void restore()
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
Restores <a href="SkCanvas_Reference#Canvas">Canvas</a> to saved state immediately. Subsequent calls and
|
2018-02-01 14:37:32 +00:00
|
|
|
<a href="#SkAutoCanvasRestore_destructor">~SkAutoCanvasRestore</a> have no effect.
|
2018-01-22 12:55:48 +00:00
|
|
|
|
|
|
|
### Example
|
|
|
|
|
|
|
|
<div><fiddle-embed name="9f459b218ec079c1ada23f4412968f9a">
|
|
|
|
|
|
|
|
#### 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
|
|
|
|
~~~~
|
|
|
|
|
|
|
|
</fiddle-embed></div>
|
|
|
|
|
|
|
|
### See Also
|
|
|
|
|
|
|
|
<a href="#SkCanvas_save">SkCanvas::save</a> <a href="#SkCanvas_restore">SkCanvas::restore</a>
|
|
|
|
|
|
|
|
---
|
|
|
|
|