skia2/docs/SkAutoCanvasRestore_Reference.bmh
Cary Clark 77b3f3aeee Check every word in docs
This enables checking all text to see if it
either represents a valid reference or is a
word in docs/spelling.txt . Expressions are
checked for validity as well.

There are a few shortcuts (marked with TODO):
- typedefs aren't resolved, so cheats are
added for SkVector and SkIVector.
- operator overload detection is incomplete
- constructor detection is incomplete
- formula definitions aren't detected

Found and fixed a bunch of spelling, usage,
and incorrect or obsolete references.

A few comment changes are needed in
include/core to get this to work, mostly
centered around recent SkPaint/SkFont edits.

TBR=reed@google.com
Docs-Preview: https://skia.org/?cl=167541
Bug: skia:
Change-Id: I2e0d5990105c5a8482b0c0d3e50fd0b330996dd6
Reviewed-on: https://skia-review.googlesource.com/c/167541
Reviewed-by: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
2018-11-08 13:27:57 +00:00

89 lines
2.0 KiB
Plaintext

#Topic Automatic_Canvas_Restore
#Class SkAutoCanvasRestore
#Code
#Populate
##
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.
#Method SkAutoCanvasRestore(SkCanvas* canvas, bool doSave)
#Line # restores Canvas when out of scope ##
#Populate
#Example
#Height 128
SkPaint p;
p.setAntiAlias(true);
p.setTextSize(64);
for (SkScalar sx : { -1, 1 } ) {
for (SkScalar sy : { -1, 1 } ) {
SkAutoCanvasRestore autoRestore(canvas, true);
SkMatrix m = SkMatrix::MakeAll(sx, 1, 96, 0, sy, 64, 0, 0, 1);
canvas->concat(m);
canvas->drawString("R", 0, 0, p);
}
}
##
#SeeAlso SkCanvas::save SkCanvas::restore
##
#Method ~SkAutoCanvasRestore()
#Line # restores Canvas to saved state ##
#Populate
#NoExample
##
#SeeAlso SkCanvas::save SkCanvas::restore
##
#Method void restore()
#In Member_Function
#Line # restores Canvas to saved state ##
#Populate
#Example
for (bool callRestore : { false, true } ) {
for (bool saveCanvas : {false, true} ) {
SkAutoCanvasRestore autoRestore(canvas, saveCanvas);
if (!saveCanvas) {
canvas->save();
}
SkDebugf("saveCanvas: %s before restore: %d\n",
saveCanvas ? "true" : "false", canvas->getSaveCount());
if (callRestore) autoRestore.restore();
SkDebugf("saveCanvas: %s after restore: %d\n",
saveCanvas ? "true" : "false", canvas->getSaveCount());
}
}
SkDebugf("final count: %d\n", canvas->getSaveCount());
#StdOut
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
##
##
#SeeAlso SkCanvas::save SkCanvas::restore
##
#Class SkAutoCanvasRestore ##
#Topic Automatic_Canvas_Restore ##