2f0ca4dbf0
for x in docs/examples/* ; do if grep -q '// Disabled' $x; then continue fi HASH=$(sed -n 's#^// HASH=\(.*\)$#\1#p' $x) NAME=$(sed -n 's#^REG_FIDDLE(\([^,]*\),.*$#\1#p' $x) FILES="$(grep -l $HASH site/user/api/*.md)" if [ "$FILES" ] ; then echo $HASH $NAME $FILES; sed -i "s/$HASH/@$NAME/g" $FILES fi done https://skia.org/user/api/SkAutoCanvasRestore_Reference?cl=248158 https://skia.org/user/api/SkBitmap_Reference?cl=248158 https://skia.org/user/api/SkBlendMode_Reference?cl=248158 https://skia.org/user/api/SkCanvas_Reference?cl=248158 https://skia.org/user/api/SkColor4f_Reference?cl=248158 https://skia.org/user/api/SkColor_Reference?cl=248158 https://skia.org/user/api/SkFont_Reference?cl=248158 https://skia.org/user/api/SkIPoint_Reference?cl=248158 https://skia.org/user/api/SkIRect_Reference?cl=248158 https://skia.org/user/api/SkImageInfo_Reference?cl=248158 https://skia.org/user/api/SkImage_Reference?cl=248158 https://skia.org/user/api/SkMatrix_Reference?cl=248158 https://skia.org/user/api/SkPaint_Reference?cl=248158 https://skia.org/user/api/SkPath_Reference?cl=248158 https://skia.org/user/api/SkPicture_Reference?cl=248158 https://skia.org/user/api/SkPixmap_Reference?cl=248158 https://skia.org/user/api/SkPoint_Reference?cl=248158 https://skia.org/user/api/SkRRect_Reference?cl=248158 https://skia.org/user/api/SkRect_Reference?cl=248158 https://skia.org/user/api/SkRegion_Reference?cl=248158 https://skia.org/user/api/SkSurface_Reference?cl=248158 https://skia.org/user/api/SkTextBlobBuilder_Reference?cl=248158 https://skia.org/user/api/SkTextBlob_Reference?cl=248158 No-Try: true Change-Id: I29ff57f3c1dd9f27f67be5511c942e7108908642 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248158 Auto-Submit: Hal Canary <halcanary@google.com> Commit-Queue: Ben Wagner aka dogben <benjaminwagner@google.com> Reviewed-by: Ben Wagner aka dogben <benjaminwagner@google.com>
105 lines
3.8 KiB
Markdown
105 lines
3.8 KiB
Markdown
SkAutoCanvasRestore Reference
|
|
===
|
|
|
|
|
|
<a name='SkAutoCanvasRestore'></a>
|
|
|
|
---
|
|
|
|
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
|
class <a href='SkAutoCanvasRestore_Reference#SkAutoCanvasRestore'>SkAutoCanvasRestore</a> {
|
|
|
|
<a href='#SkAutoCanvasRestore_SkCanvas_star'>SkAutoCanvasRestore</a>(<a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>* <a href='SkCanvas_Reference#Canvas'>canvas</a>, bool doSave);
|
|
<a href='#SkAutoCanvasRestore_destructor'>~SkAutoCanvasRestore()</a>;
|
|
void <a href='#SkAutoCanvasRestore_restore'>restore()</a>;
|
|
};
|
|
|
|
</pre>
|
|
|
|
Stack helper class calls <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_restoreToCount'>restoreToCount</a> when <a href='SkAutoCanvasRestore_Reference#SkAutoCanvasRestore'>SkAutoCanvasRestore</a>
|
|
goes out of scope. Use this to guarantee that the <a href='SkCanvas_Reference#Canvas'>canvas</a> is restored to a known
|
|
state.
|
|
|
|
<a name='SkAutoCanvasRestore_SkCanvas_star'></a>
|
|
|
|
---
|
|
|
|
<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
|
|
<a href='#SkAutoCanvasRestore_SkCanvas_star'>SkAutoCanvasRestore</a>(<a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>* <a href='SkCanvas_Reference#Canvas'>canvas</a>, bool doSave)
|
|
</pre>
|
|
|
|
Preserves <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_save'>save()</a> count. Optionally saves <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a> clip and <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a> <a href='SkMatrix_Reference#Matrix'>matrix</a>.
|
|
|
|
### Parameters
|
|
|
|
<table> <tr> <td><a name='SkAutoCanvasRestore_SkCanvas_star_canvas'><code><strong>canvas</strong></code></a></td>
|
|
<td><a href='SkCanvas_Reference#SkCanvas'>SkCanvas</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_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_save'>save()</a></td>
|
|
</tr>
|
|
</table>
|
|
|
|
### Return Value
|
|
|
|
utility to restore <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a> state on destructor
|
|
|
|
### Example
|
|
|
|
<div><fiddle-embed name="@AutoCanvasRestore_SkCanvas_star"></fiddle-embed></div>
|
|
|
|
### See Also
|
|
|
|
<a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_save'>save</a> <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_restore'>restore</a>
|
|
|
|
<a name='SkAutoCanvasRestore_destructor'></a>
|
|
|
|
---
|
|
|
|
<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
|
|
<a href='#SkAutoCanvasRestore_destructor'>~SkAutoCanvasRestore()</a>
|
|
</pre>
|
|
|
|
Restores <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a> to saved state. Destructor is called when container goes out of
|
|
scope.
|
|
|
|
### See Also
|
|
|
|
<a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_save'>save</a> <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_restore'>restore</a>
|
|
|
|
<a name='SkAutoCanvasRestore_restore'></a>
|
|
|
|
---
|
|
|
|
<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0">
|
|
void <a href='#SkAutoCanvasRestore_restore'>restore()</a>
|
|
</pre>
|
|
|
|
Restores <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a> to saved state immediately. Subsequent calls and
|
|
<a href='#SkAutoCanvasRestore_destructor'>~SkAutoCanvasRestore()</a> have no effect.
|
|
|
|
### Example
|
|
|
|
<div><fiddle-embed name="@AutoCanvasRestore_restore">
|
|
|
|
#### 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_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_save'>save</a> <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_restore'>restore</a>
|
|
|