canvas include checkpoint

All fixes to bookmaker to allow creating SkCanvas.h

Docs-Preview: https://skia.org/?cl=29022
TBR=caryclark@google.com
Bug: skia: 6898
Change-Id: If10638fbc77cfe680f21868c97f9c0643b87ebf9
Reviewed-on: https://skia-review.googlesource.com/29022
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
This commit is contained in:
Cary Clark 2017-08-03 17:14:08 -04:00 committed by Skia Commit-Bot
parent 161f9a6dc6
commit bad5ad7d60
14 changed files with 4233 additions and 3318 deletions

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,8 @@ Paint does not directly implement dashing or blur, but contains the objects that
The objects contained by Paint are opaque, and cannot be edited outside of the Paint
to affect it. The implementation is free to defer computations associated with the
Paint, or ignore them altogether. For instance, some GPU implementations draw all
Path geometries with anti-aliasing, regardless of SkPaint::kAntiAlias_Flag setting.
Path geometries with anti-aliasing, regardless of how SkPaint::kAntiAlias_Flag
is set in Paint.
Paint describes a single color, a single font, a single image quality, and so on.
Multiple colors are drawn either by using multiple paints or with objects like
@ -317,7 +318,8 @@ $$$# # restore original markup character
Makes a shallow copy of Paint. Typeface, Path_Effect, Shader,
Mask_Filter, Color_Filter, Rasterizer, Draw_Looper, and Image_Filter are shared
between the original paint and the copy. These objects' Reference_Count are increased.
between the original paint and the copy. Objects containing Reference_Count increment
their references by one.
The referenced objects Path_Effect, Shader, Mask_Filter, Color_Filter, Rasterizer,
Draw_Looper, and Image_Filter cannot be modified after they are created.
@ -398,7 +400,7 @@ the paint with the result of SkPaint().
Decreases Paint Reference_Count of owned objects: Typeface, Path_Effect, Shader,
Mask_Filter, Color_Filter, Rasterizer, Draw_Looper, and Image_Filter. If the
objects' reference count goes to zero, they are deleted.
objects containing Reference_Count go to zero, they are deleted.
#NoExample
##
@ -413,10 +415,10 @@ objects' reference count goes to zero, they are deleted.
Makes a shallow copy of Paint. Typeface, Path_Effect, Shader,
Mask_Filter, Color_Filter, Rasterizer, Draw_Looper, and Image_Filter are shared
between the original paint and the copy. The objects' Reference_Count are in the
between the original paint and the copy. Objects containing Reference_Count in the
prior destination are decreased by one, and the referenced objects are deleted if the
resulting count is zero. The objects' Reference_Count in the parameter paint are increased
by one. paint is unmodified.
resulting count is zero. Objects containing Reference_Count in the parameter paint
are increased by one. paint is unmodified.
#Param paint original to copy ##
@ -442,9 +444,9 @@ by one. paint is unmodified.
#Method SkPaint& operator=(SkPaint&& paint)
Moves the paint to avoid incrementing the reference counts
of objects referenced by the paint parameter. The objects' Reference_Count are in the
prior destination are decreased by one, and the referenced objects are deleted if the
resulting count is zero.
of objects referenced by the paint parameter. Objects containing Reference_Count in the
prior destination are decreased by one; those objects are deleted if the resulting count
is zero.
After the call, paint is undefined, and can be safely destructed.
@ -644,7 +646,7 @@ by the client.
kNo_Hinting = 0,
kSlight_Hinting = 1,
kNormal_Hinting = 2,
kFull_Hinting = 3
kFull_Hinting = 3,
};
##
@ -2090,7 +2092,7 @@ a fill draw.
#Code
enum {
kStyleCount = kStrokeAndFill_Style + 1
kStyleCount = kStrokeAndFill_Style + 1,
};
##
@ -2377,7 +2379,7 @@ Here are some miter limits and the angles that triggers them.
kSquare_Cap,
kLast_Cap = kSquare_Cap,
kDefault_Cap = kButt_Cap
kDefault_Cap = kButt_Cap,
};
static constexpr int kCapCount = kLast_Cap + 1;
##
@ -2520,7 +2522,7 @@ the following curve, the pair of curves meet at Stroke_Join.
kBevel_Join,
kLast_Join = kBevel_Join,
kDefault_Join = kMiter_Join
kDefault_Join = kMiter_Join,
};
static constexpr int kJoinCount = kLast_Join + 1;
##
@ -3724,7 +3726,7 @@ Align defaults to kLeft_Align.
#Code
enum {
kAlignCount = 3
kAlignCount = 3,
};
##
@ -3987,7 +3989,7 @@ Text_Skew_X defaults to 0.
kUTF8_TextEncoding,
kUTF16_TextEncoding,
kUTF32_TextEncoding,
kGlyphID_TextEncoding
kGlyphID_TextEncoding,
};
##

View File

@ -10,11 +10,13 @@
HTML_Canvas HTML_Canvas_arcTo
API
CPU
GPU GPU-backed GPU_Context OpenGL Vulkan
GPU GPU-backed OpenGL Vulkan
NULL
RFC
Bezier Coons
SaveLayerFlags # not external; need to add typedef support
SkUserConfig.h # not external, but still thinking about how markup refers to this
SkXXX.h # ditto
Skia # ditto
SK_USE_FREETYPE_EMBOLDEN # ditto
SK_SUPPORT_LEGACY_PAINT_TEXTDECORATION # ditto
@ -206,6 +208,14 @@ FT_Load_Glyph
#Topic Glyph
##
#Topic GPU_Context
#Substitute GPU context
##
#Topic GPU_Surface
#Substitute GPU surface
##
#Topic Image
#Subtopic Alpha_Type
#Enum SkAlphaType
@ -365,6 +375,9 @@ FT_Load_Glyph
##
##
#Enum SkPixelGeometry
##
#Topic Pixmap
#Class SkPixmap
##
@ -390,6 +403,9 @@ FT_Load_Glyph
##
##
#Topic Raster_Surface
##
#Topic Rasterizer
#Class SkRasterizer
#Class ##
@ -470,18 +486,14 @@ FT_Load_Glyph
##
#Subtopic Properties
#Class SkSurfaceProps
#Topic Legacy_Font_Host
#Enum InitType
#Const kLegacyFontHost_InitType 0
##
##
#Topic ##
##
##
#Subtopic GPU
#Alias GPU_Surface
##
#Subtopic Raster
#Alias Raster_Surface
##
##
#Topic SVG

View File

@ -16,10 +16,9 @@ Get the fiddle command line interface tool.
$ go get go.skia.org/infra/fiddle/go/fiddlecli
##
Get the Bookmaker CL and build it.
Build Bookmaker.
#Code
$ git cl patch 9919
$ ninja -C out/dir bookmaker
##
@ -31,7 +30,8 @@ out/dir/obj/ from an IDE.
$ ./out/dir/bookmaker -t -i include/core/SkXXX.h
##
Use your favorite editor to fill out SkXXX.bmh.
Copy SkXXX.bmh to docs.
Use your favorite editor to fill out docs/SkXXX.bmh.
Generate fiddle.json from all examples, including the ones you just wrote.
Error checking is syntatic: starting keywords are closed, keywords have the
@ -40,7 +40,7 @@ If you run Bookmaker inside Visual_Studio, you can click on errors and it
will take you to the source line in question.
#Code
$ ./out/dir/bookmaker -e fiddle.json -b current_directory
$ ./out/dir/bookmaker -e fiddle.json -b docs
##
Once complete, run fiddlecli to generate the example hashes.
@ -56,7 +56,7 @@ missing or mismatched printf output.
Again, you can click on any errors inside Visual_Studio.
#Code
$ ./out/dir/bookmaker -r site/user/api -b current_directory -f fiddleout.json
$ ./out/dir/bookmaker -r site/user/api -b docs -f fiddleout.json
##
The original include may have changed since you started creating the markdown.
@ -64,32 +64,20 @@ Check to see if it is up to date.
This reports if a method no longer exists or its parameters have changed.
#Code
$ ./out/dir/bookmaker -x -b current_directory/SkXXX.bmh -i include/core/SkXXX.h
$ ./out/dir/bookmaker -x -b docs/SkXXX.bmh -i include/core/SkXXX.h
##
#Topic Bugs
#List
overaggressive reference finding in code block
missing examples
redundant examples -- got tired so used the same one more than once
some examples need vertical resizing
list doesn't work (ironic, huh)
##
Generate an updated include header.
This writes the updated SkXXX.h to the current directory.
#Code
$ ./out/dir/bookmaker -p -b docs -i include/core/SkXXX.h
##
#Topic To_Do
#List
check that all methods have one line descriptions in overview
see also -- anything that can be done automatically? maybe any ref shows up everywhere
index by example png
generate pdf or pdf-like out
generate b/w out instead of color -- have b/w versions of examples?
formalize voice / syntax for parts of topic and method
write bmh data back into include
have a way to write one block that covers multiple nearly indentical methods?
may want to do this for pdf view as well
write a one-method-per-page online view?
##
#Subtopic Bugs
Bookmaker bugs are tracked #A here # bug.skia.org/6898 ##.
##
#Topic Bookmaker ##

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,8 @@ algorithms that alter the drawing geometry, color, and transparency. For instanc
The objects contained by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> are opaque, and cannot be edited outside of the <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>
to affect it. The implementation is free to defer computations associated with the
<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>, or ignore them altogether. For instance, some <a href="bmh_undocumented?cl=9919#GPU">GPU</a> implementations draw all
<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> geometries with anti-aliasing, regardless of <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">SkPaint::kAntiAlias Flag</a> setting.
<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> geometries with anti-aliasing, regardless of how <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">SkPaint::kAntiAlias Flag</a>
is set in <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>.
<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> describes a single color, a single font, a single image quality, and so on.
Multiple colors are drawn either by using multiple paints or with objects like
@ -291,7 +292,8 @@ SkPaint(const SkPaint& paint)
Makes a shallow copy of <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>,
<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, and <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> are shared
between the original <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> and the copy. These objects' <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> are increased.
between the original <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> and the copy. Objects containing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> increment
their references by one.
The referenced objects <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>,
<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, and <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> cannot be modified after they are created.
@ -395,7 +397,7 @@ paint1 == paint2
Decreases <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of owned objects: <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>,
<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, and <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>. If the
objects' reference count goes to zero, they are deleted.
objects containing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> go to zero, they are deleted.
---
@ -410,10 +412,10 @@ SkPaint& operator=(const SkPaint& paint)
Makes a shallow copy of <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>,
<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, and <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> are shared
between the original <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> and the copy. The objects' <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> are in the
between the original <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> and the copy. Objects containing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> in the
prior destination are decreased by one, and the referenced objects are deleted if the
resulting count is zero. The objects' <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> in the parameter <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> are increased
by one. <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> is unmodified.
resulting count is zero. Objects containing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> in the parameter <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a>
are increased by one. <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> is unmodified.
### Parameters
@ -449,9 +451,9 @@ SkPaint& operator=(SkPaint&& paint)
</pre>
Moves the <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> to avoid incrementing the reference counts
of objects referenced by the <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> parameter. The objects' <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> are in the
prior destination are decreased by one, and the referenced objects are deleted if the
resulting count is zero.
of objects referenced by the <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> parameter. Objects containing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> in the
prior destination are decreased by one; those objects are deleted if the resulting count
is zero.
After the call, <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> is undefined, and can be safely destructed.
@ -656,7 +658,7 @@ enum <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> {
<a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a> = 0,
<a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a> = 1,
<a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> = 2,
<a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a> = 3
<a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a> = 3,
};</pre>
<a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> adjusts the glyph outlines so that the shape provides a uniform
@ -1030,7 +1032,7 @@ Dithering is always enabled for linear gradients drawing into
<a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> can be enabled by default by setting <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Flags">SkPaintDefaults Flags</a> to <a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a>
at compile time.
Some platform implementations may ignore dithering. Setto ignore <a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> on <a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a>.
Some platform implementations may ignore dithering. Setto ignore <a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> on <a href="bmh_undocumented?cl=9919#GPU_Surface">GPU Surface</a>.
### Example
@ -1430,7 +1432,7 @@ paint1 == paint2
# <a name="Automatic_Hinting"></a> Automatic Hinting
If <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> or <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a>
instructs the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> to always hint Glyphs.
instructs the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> to always hint glyphs.
<a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a> has no effect if <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a> or
<a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a>.
@ -1445,7 +1447,7 @@ bool isAutohinted() const
If true, and if <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> or <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a>, and if
platform uses <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> as the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a>, instruct the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> to always hint
Glyphs.
glyphs.
Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a>.
@ -1480,11 +1482,11 @@ void setAutohinted(bool useAutohinter)
</pre>
If <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> or <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a> and <a href="bmh_SkPaint_Reference?cl=9919#useAutohinter">useAutohinter</a> is set,
instruct the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> to always hint Glyphs.
instruct the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> to always hint glyphs.
<a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a> has no effect if <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a> or
<a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a>.
<a href="bmh_SkPaint_Reference?cl=9919#setAutohinted">setAutohinted</a> only affects platforms that use <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> as the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a>.
Only affects platforms that use <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> as the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a>.
Sets <a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#useAutohinter">useAutohinter</a> is true.
Clears <a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#useAutohinter">useAutohinter</a> is false.
@ -1802,7 +1804,7 @@ void setFilterQuality(SkFilterQuality quality)
Sets <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a>, the image filtering level. A lower setting
draws faster; a higher setting looks better when the image is scaled.
<a href="bmh_SkPaint_Reference?cl=9919#setFilterQuality">setFilterQuality</a> does not check to see if <a href="bmh_SkPaint_Reference?cl=9919#setFilterQuality">quality</a> is valid.
Does not check to see if <a href="bmh_SkPaint_Reference?cl=9919#setFilterQuality">quality</a> is valid.
### Parameters
@ -2111,7 +2113,7 @@ and the set <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a>
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
enum {
<a href="bmh_SkPaint_Reference?cl=9919#kStyleCount">kStyleCount</a> = <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a> + 1
<a href="bmh_SkPaint_Reference?cl=9919#kStyleCount">kStyleCount</a> = <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a> + 1,
};</pre>
### Constants
@ -2381,7 +2383,7 @@ enum <a href="bmh_SkPaint_Reference?cl=9919#Cap">Cap</a> {
<a href="bmh_SkPaint_Reference?cl=9919#kSquare_Cap">kSquare Cap</a>,
<a href="bmh_SkPaint_Reference?cl=9919#kLast_Cap">kLast Cap</a> = <a href="bmh_SkPaint_Reference?cl=9919#kSquare_Cap">kSquare Cap</a>,
<a href="bmh_SkPaint_Reference?cl=9919#kDefault_Cap">kDefault Cap</a> = <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a>
<a href="bmh_SkPaint_Reference?cl=9919#kDefault_Cap">kDefault Cap</a> = <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a>,
};
static constexpr int <a href="bmh_SkPaint_Reference?cl=9919#kCapCount">kCapCount</a> = <a href="bmh_SkPaint_Reference?cl=9919#kLast_Cap">kLast Cap</a> + 1;</pre>
@ -2525,11 +2527,11 @@ enum <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a> {
<a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a>,
<a href="bmh_SkPaint_Reference?cl=9919#kLast_Join">kLast Join</a> = <a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a>,
<a href="bmh_SkPaint_Reference?cl=9919#kDefault_Join">kDefault Join</a> = <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>
<a href="bmh_SkPaint_Reference?cl=9919#kDefault_Join">kDefault Join</a> = <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>,
};
static constexpr int <a href="bmh_SkPaint_Reference?cl=9919#kJoinCount">kJoinCount</a> = <a href="bmh_SkPaint_Reference?cl=9919#kLast_Join">kLast Join</a> + 1;</pre>
<a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a> specifies how corners are drawn when a shape is stroked. The paint's <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a> setting
<a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a> specifies how corners are drawn when a shape is stroked. <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a>
affects the four corners of a stroked rectangle, and the connected segments in a
stroked path.
@ -2621,7 +2623,7 @@ The geometry drawn at the corners of strokes.
<table> <tr> <td><code><strong>join </strong></code></td> <td>
one of: <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>, <a href="bmh_SkPaint_Reference?cl=9919#kRound_Join">kRound Join</a>, <a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a>;
otherwise, <a href="bmh_SkPaint_Reference?cl=9919#setStrokeJoin">setStrokeJoin</a> has no effect</td>
otherwise, has no effect</td>
</tr>
</table>
@ -2954,7 +2956,7 @@ SkBlendMode getBlendMode() const
</pre>
Returns <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>.
By default, <a href="bmh_SkPaint_Reference?cl=9919#getBlendMode">getBlendMode</a> returns <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a>.
By default, returns <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a>.
### Return Value
@ -3610,7 +3612,7 @@ void setDrawLooper(sk_sp<SkDrawLooper> drawLooper)
Sets <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> to <a href="bmh_SkPaint_Reference?cl=9919#drawLooper">drawLooper</a>,
decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_SkPaint_Reference?cl=9919#drawLooper">drawLooper</a>.
Pass nullptr to clear <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> and leave <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> effect on drawing unaltered.
<a href="bmh_SkPaint_Reference?cl=9919#setDrawLooper">setDrawLooper</a> does not alter <a href="bmh_SkPaint_Reference?cl=9919#drawLooper">drawLooper</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
Does not alter <a href="bmh_SkPaint_Reference?cl=9919#drawLooper">drawLooper</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
### Parameters
@ -3695,7 +3697,7 @@ and by its height if <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> has
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
enum {
<a href="bmh_SkPaint_Reference?cl=9919#kAlignCount">kAlignCount</a> = 3
<a href="bmh_SkPaint_Reference?cl=9919#kAlignCount">kAlignCount</a> = 3,
};</pre>
### Constants
@ -3936,7 +3938,7 @@ enum <a href="bmh_SkPaint_Reference?cl=9919#TextEncoding">TextEncoding</a> {
<a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a>,
<a href="bmh_SkPaint_Reference?cl=9919#kUTF16_TextEncoding">kUTF16 TextEncoding</a>,
<a href="bmh_SkPaint_Reference?cl=9919#kUTF32_TextEncoding">kUTF32 TextEncoding</a>,
<a href="bmh_SkPaint_Reference?cl=9919#kGlyphID_TextEncoding">kGlyphID TextEncoding</a>
<a href="bmh_SkPaint_Reference?cl=9919#kGlyphID_TextEncoding">kGlyphID TextEncoding</a>,
};</pre>
<a href="bmh_SkPaint_Reference?cl=9919#TextEncoding">TextEncoding</a> determines whether text specifies character codes and their encoded size,
@ -4026,8 +4028,11 @@ Invalid values for <a href="bmh_SkPaint_Reference?cl=9919#setTextEncoding">encod
### Parameters
<table> <tr> <td><code><strong>encoding </strong></code></td> <td>
one of: <a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a>, <a href="bmh_SkPaint_Reference?cl=9919#kUTF16_TextEncoding">kUTF16 TextEncoding</a>, <a href="bmh_SkPaint_Reference?cl=9919#kUTF32_TextEncoding">kUTF32 TextEncoding</a>, or</td>
one of: <a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a>, <a href="bmh_SkPaint_Reference?cl=9919#kUTF16_TextEncoding">kUTF16 TextEncoding</a>, <a href="bmh_SkPaint_Reference?cl=9919#kUTF32_TextEncoding">kUTF32 TextEncoding</a>, or
<a href="bmh_SkPaint_Reference?cl=9919#kGlyphID_TextEncoding">kGlyphID TextEncoding</a></td>
</tr>
#
</table>
### Example
@ -4370,7 +4375,7 @@ Returns the recommended spacing between lines: the sum of metrics
descent, ascent, and leading.
Result is scaled by <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> but does not take into account
dimensions required by stroking and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>.
<a href="bmh_SkPaint_Reference?cl=9919#getFontSpacing">getFontSpacing</a> returns the same result as <a href="bmh_SkPaint_Reference?cl=9919#getFontMetrics">getFontMetrics</a>.
Returns the same result as <a href="bmh_SkPaint_Reference?cl=9919#getFontMetrics">getFontMetrics</a>.
### Return Value
@ -4402,11 +4407,11 @@ SkRect getFontBounds() const
Returns the union of bounds of all glyphs.
Returned dimensions are computed by <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> from font data,
ignoring <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a>. <a href="bmh_SkPaint_Reference?cl=9919#getFontBounds">getFontBounds</a> includes <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a>,
ignoring <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a>. Includes <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a>,
and <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a>, but not <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> or <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>.
If <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> is large, <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a> is one, and <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> is zero,
<a href="bmh_SkPaint_Reference?cl=9919#getFontBounds">getFontBounds</a> returns the same bounds as <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> { <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fXMin">FontMetrics::fXMin</a>,
returns the same bounds as <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> { <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fXMin">FontMetrics::fXMin</a>,
<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fTop">FontMetrics::fTop</a>, <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fXMax">FontMetrics::fXMax</a>, <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fBottom">FontMetrics::fBottom</a> }.
### Return Value
@ -4443,7 +4448,7 @@ Returns the number of glyph indices represented by <a href="bmh_SkPaint_Referenc
Does not check <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> for valid character encoding or valid
glyph indices.
If <a href="bmh_SkPaint_Reference?cl=9919#byteLength">byteLength</a> equals zero, <a href="bmh_SkPaint_Reference?cl=9919#textToGlyphs">textToGlyphs</a> returns zero.
If <a href="bmh_SkPaint_Reference?cl=9919#byteLength">byteLength</a> equals zero, returns zero.
If <a href="bmh_SkPaint_Reference?cl=9919#byteLength">byteLength</a> includes a partial character, the partial character is ignored.
If <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> is <a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a> and
@ -4519,8 +4524,8 @@ Returns true if all <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> corres
Returns false if any characters in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> are not supported in
<a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>.
If <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> is <a href="bmh_SkPaint_Reference?cl=9919#kGlyphID_TextEncoding">kGlyphID TextEncoding</a>, <a href="bmh_SkPaint_Reference?cl=9919#containsText">containsText</a>
returns true if all glyph indices in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> are non-zero; <a href="bmh_SkPaint_Reference?cl=9919#containsText">containsText</a>
If <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> is <a href="bmh_SkPaint_Reference?cl=9919#kGlyphID_TextEncoding">kGlyphID TextEncoding</a>,
returns true if all glyph indices in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> are non-zero;
does not check to see if <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> contains valid glyph indices for <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>.
Returns true if bytelength is zero.
@ -4784,7 +4789,7 @@ Returns the geometry as <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> equ
Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the glyph paths,
and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale and modify the glyph paths.
All of the glyph paths are stored in <a href="bmh_SkPaint_Reference?cl=9919#path">path</a>.
<a href="bmh_SkPaint_Reference?cl=9919#getTextPath">getTextPath</a> uses <a href="bmh_SkPaint_Reference?cl=9919#x">x</a>, <a href="bmh_SkPaint_Reference?cl=9919#y">y</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to position <a href="bmh_SkPaint_Reference?cl=9919#path">path</a>.
Uses <a href="bmh_SkPaint_Reference?cl=9919#x">x</a>, <a href="bmh_SkPaint_Reference?cl=9919#y">y</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to position <a href="bmh_SkPaint_Reference?cl=9919#path">path</a>.
### Parameters
@ -5027,8 +5032,8 @@ number of intersections; may be zero
bool nothingToDraw() const
</pre>
Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> prevents all drawing.
If <a href="bmh_SkPaint_Reference?cl=9919#nothingToDraw">nothingToDraw</a> returns false, the <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> may or may not allow drawing.
Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> prevents all drawing;
otherwise, the <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> may or may not allow drawing.
Returns true if <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> and <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> are enabled,
and computed <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> is zero.

View File

@ -832,7 +832,7 @@ enum <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> {
<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is convex if it contains one <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> and <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> loops no more than
360 degrees, and <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> angles all have same <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a>. Convex <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>
may have better performance and require fewer resources on <a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a>.
may have better performance and require fewer resources on <a href="bmh_undocumented?cl=9919#GPU_Surface">GPU Surface</a>.
<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is concave when either at least one <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> change is clockwise and
another is counterclockwise, or the sum of the changes in <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> is not 360
@ -998,7 +998,7 @@ bool isOval(SkRect* rect, Direction* dir = nullptr, unsigned* start = nullptr) c
<a href="bmh_SkPath_Reference?cl=9919#addRoundRect">addRoundRect</a>, <a href="bmh_SkPath_Reference?cl=9919#addRRect">addRRect</a>. <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> constructed with <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> or <a href="bmh_SkPath_Reference?cl=9919#rConicTo">rConicTo</a> will not
return true though <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> draws <a href="bmh_undocumented?cl=9919#Oval">Oval</a>.
<a href="bmh_SkPath_Reference?cl=9919#isOval">isOval</a> triggers performance optimizations on some <a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a> implementations.
<a href="bmh_SkPath_Reference?cl=9919#isOval">isOval</a> triggers performance optimizations on some <a href="bmh_undocumented?cl=9919#GPU_Surface">GPU Surface</a> implementations.
### Parameters
@ -1039,7 +1039,7 @@ bool isRRect(SkRRect* rrect, Direction* dir = nullptr, unsigned* start = nullptr
is not empty, not <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, and not <a href="bmh_undocumented?cl=9919#Oval">Oval</a>. <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> constructed with other other calls
will not return true though <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> draws <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>.
<a href="bmh_SkPath_Reference?cl=9919#isRRect">isRRect</a> triggers performance optimizations on some <a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a> implementations.
<a href="bmh_SkPath_Reference?cl=9919#isRRect">isRRect</a> triggers performance optimizations on some <a href="bmh_undocumented?cl=9919#GPU_Surface">GPU Surface</a> implementations.
### Parameters
@ -1274,8 +1274,8 @@ to inform <a href="bmh_undocumented?cl=9919#Device">Device</a> that the path nee
Mark animating <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> volatile to improve performance.
Mark unchanging <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> non-volative to improve repeated rendering.
<a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a> <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> draws are affected by volatile for some shadows.
<a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a> <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> draws are affected by volatile for some shadows and concave geometries.
<a href="bmh_undocumented?cl=9919#Raster_Surface">Raster Surface</a> <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> draws are affected by volatile for some shadows.
<a href="bmh_undocumented?cl=9919#GPU_Surface">GPU Surface</a> <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> draws are affected by volatile for some shadows and concave geometries.
### Parameters

View File

@ -1,4 +1,4 @@
(to be documented)
undocumented
===
# <a name="Glyph"></a> Glyph
@ -302,6 +302,10 @@ static std::unique_ptr<SkCanvas>
# <a name="Font_Manager"></a> Font Manager
# <a name="GPU_Context"></a> GPU Context
# <a name="GPU_Surface"></a> GPU Surface
# <a name="Image"></a> Image
## <a name="Alpha_Type"></a> Alpha Type
@ -503,6 +507,8 @@ SkCanvas* beginRecording(const SkRect& bounds, SkBBHFactory* bbhFactory = NULL,
# <a name="SkPixmap"></a> Class SkPixmap
# <a name="Raster_Surface"></a> Raster Surface
# <a name="Rasterizer"></a> Rasterizer
# <a name="SkRasterizer"></a> Class SkRasterizer
@ -596,6 +602,8 @@ static sk_sp<SkSurface> MakeRasterDirect(const SkImageInfo&, void* pixels,
# <a name="SkSurfaceProps"></a> Class SkSurfaceProps
# <a name="Legacy_Font_Host"></a> Legacy Font Host
## <a name="SkSurfaceProps::InitType"></a> Enum SkSurfaceProps::InitType
### Constants
@ -607,10 +615,6 @@ static sk_sp<SkSurface> MakeRasterDirect(const SkImageInfo&, void* pixels,
</table>
## <a name="GPU"></a> GPU
## <a name="Raster"></a> Raster
# <a name="SVG"></a> SVG
## <a name="Canvas"></a> Canvas

View File

@ -1,4 +1,4 @@
using Bookmaker
usingBookmaker
===
# <a name="Bookmaker"></a> Bookmaker
@ -9,10 +9,9 @@ Get the fiddle command line interface tool.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
$ go get go.skia.org/infra/fiddle/go/fiddlecli</pre>
Get the <a href="bmh_usingBookmaker?cl=9919#Bookmaker">Bookmaker</a> <a href="bmh_usingBookmaker?cl=9919#CL">CL</a> and build it.
Build <a href="bmh_usingBookmaker?cl=9919#Bookmaker">Bookmaker</a>.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
$ git cl patch 9919
$ ninja -<a href="bmh_usingBookmaker?cl=9919#C">C</a> out/dir bookmaker</pre>
Generate an starter <a href="bmh_usingBookmaker?cl=9919#Bookmaker">Bookmaker</a> file from an existing include.
@ -22,7 +21,8 @@ out/dir/obj/ from an IDE.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
$ ./out/dir/bookmaker -t -i include/core/<a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.h</pre>
Use your favorite editor to fill out <a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.bmh.
Copy <a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.bmh to docs.
Use your favorite editor to fill out docs/<a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.bmh.
Generate fiddle.json from all examples, including the ones you just wrote.
Error checking is syntatic: starting keywords are closed, keywords have the
@ -31,7 +31,7 @@ If you run <a href="bmh_usingBookmaker?cl=9919#Bookmaker">Bookmaker</a> inside <
will take you to the source line in question.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
$ ./out/dir/bookmaker -e fiddle.json -b current_directory</pre>
$ ./out/dir/bookmaker -e fiddle.json -b docs</pre>
Once complete, run fiddlecli to generate the example hashes.
Errors are contained by the output but aren't reported yet.
@ -45,35 +45,21 @@ missing or mismatched printf output.
Again, you can click on any errors inside <a href="bmh_usingBookmaker?cl=9919#Visual_Studio">Visual Studio</a>.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
$ ./out/dir/bookmaker -r site/user/api -b current_directory -f fiddleout.json</pre>
$ ./out/dir/bookmaker -r site/user/api -b docs -f fiddleout.json</pre>
The original include may have changed since you started creating the markdown.
Check to see if it is up to date.
This reports if a method no longer exists or its parameters have changed.
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
$ ./out/dir/bookmaker -x -b current_directory/<a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.bmh -i include/core/<a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.h</pre>
$ ./out/dir/bookmaker -x -b docs/<a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.bmh -i include/core/<a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.h</pre>
# <a name="Bugs"></a> Bugs
Generate an updated include header.
This writes the updated <a href="bmh_undocumented?cl=9919#SkXXX.h">SkXXX.h</a> to the current directory.
<table>
overaggressive reference finding in code block
missing examples
redundant examples -- got tired so used the same one more than once
some examples need vertical resizing
list doesn't work (ironic, huh)</table>
<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
$ ./out/dir/bookmaker -p -b docs -i include/core/<a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.h</pre>
# <a name="To_Do"></a> To Do
<table>
check that all methods have one line descriptions in overview
see also -- anything that can be done automatically? maybe any ref shows up everywhere
index by example png
generate pdf or pdf-like out
generate b/w out instead of color -- have b/w versions of examples?
formalize voice / syntax for parts of topic and method
write bmh data back into include
have a way to write one block that covers multiple nearly indentical methods?
may want to do this for pdf view as well
write a one-method-per-page online view?</table>
## <a name="Bugs"></a> Bugs
<a href="bmh_usingBookmaker?cl=9919#Bookmaker">Bookmaker</a> bugs are trackedherebug.skia.org/6898.

View File

@ -21,37 +21,11 @@ remove anonymous header, e.g. Enum SkPaint::::anonymous_2
Text Encoding anchors in paragraph are echoed instead of being linked to anchor names
also should not point to 'undocumented' since they are resolvable links
#Member lost all formatting
inconsistent use of capitalization in #Param
#List needs '# content ##', formatting
consts like enum members need fully qualfied refs to make a valid link
enum comments should be disallowed unless after #Enum and before first #Const
... or, should look for enum comments in other places
// in includeWriter.cpp
lf preceding #A is ignored
Text_Size should become SkPaint's text size if root is not Paint?
100 column limit done manually -- either error or rewrap
SkPaint.bmh line 22:
Insert 'the' after 'regardless of' ?
somewhat intentional. Imagine SkPaint::kXXX is 'Joe'. Then it shouldn't read 'regardless
of the Joe setting.' To make that work as a proper pronoun, maybe it should read:
'regardless of SkPaint's kAntiAlias_Flag setting or 'regardless of SkPaint's anti-alias setting'.
It's the way it is so that SkPaint::kAntiAlias_Flag can be a link to the definition.
Its awkwardness is compounded because this description is technically outside of 'class SkPaint'
so a reference to kAntiAlias_Flag by itself doesn't know that it is defined inside SkPaint,
but that's a detail I could work around.
SkPaint.bmh line 319, 400, 444
more complications I haven't figured out. I don't know when or how to pluralize
references. This should be "objects' reference counts" probably, but then
I lose the link to SkRefCnt.
SkPaint.bmh line 2639
I'd argue that 'fill path' is OK, in that is it the path that will fill, not the path
that has already been filled. I see the awkwardness though, and will add it to my bug list.
*/
static string normalized_name(string name) {
@ -1649,7 +1623,7 @@ void TextParser::reportWarning(const char* errorStr) const {
spaces -= lineLen;
lineLen = err.lineLength();
}
SkDebugf("%s(%zd): error: %s\n", fFileName.c_str(), err.fLineCount, errorStr);
SkDebugf("\n%s(%zd): error: %s\n", fFileName.c_str(), err.fLineCount, errorStr);
if (0 == lineLen) {
SkDebugf("[blank line]\n");
} else {
@ -1856,9 +1830,6 @@ string BmhParser::uniqueName(const string& base, MarkType markType) {
for (const auto& iter : fParent->fChildren) {
if (markType == iter->fMarkType) {
if (iter->fName == numBuilder) {
if (MarkType::kMethod == markType) {
SkDebugf("");
}
fCloned = true;
numBuilder = builder + '_' + to_string(number);
goto tryNext;

View File

@ -497,6 +497,35 @@ public:
return len <= (size_t) lineLen && 0 == strncmp(str, fChar, len);
}
// ignores minor white space differences
bool startsWith(const char* str, size_t oLen) const {
size_t tIndex = 0;
size_t tLen = fEnd - fChar;
size_t oIndex = 0;
while (oIndex < oLen && tIndex < tLen) {
bool tSpace = ' ' >= fChar[tIndex];
bool oSpace = ' ' >= str[oIndex];
if (tSpace != oSpace) {
break;
}
if (tSpace) {
do {
++tIndex;
} while (tIndex < tLen && ' ' >= fChar[tIndex]);
do {
++oIndex;
} while (oIndex < oLen && ' ' >= str[oIndex]);
continue;
}
if (fChar[tIndex] != str[oIndex]) {
break;
}
++tIndex;
++oIndex;
}
return oIndex >= oLen;
}
const char* strnchr(char ch, const char* end) const {
const char* ptr = fChar;
while (ptr < end) {
@ -1028,7 +1057,7 @@ public:
if (size <= 0) {
return false;
}
SkASSERT(size < 8000);
SkASSERT(size < 16000);
if (size > 3 && !strncmp("#end", data, 4)) {
fMaxLF = 1;
}
@ -1203,10 +1232,10 @@ public:
, { "EnumClass", &fClassMap, MarkType::kEnumClass, R_Y, E_O, M_CSST | M(Root) }
, { "Error", nullptr, MarkType::kError, R_N, E_N, M(Example) }
, { "Example", nullptr, MarkType::kExample, R_O, E_N, M_CSST | M_E | M(Method) }
, { "Experimental", nullptr, MarkType::kExperimental, R_Y, E_N, 0 }
, { "Experimental", nullptr, MarkType::kExperimental, R_Y, E_N, 0 }
, { "External", nullptr, MarkType::kExternal, R_Y, E_N, M(Root) }
, { "File", nullptr, MarkType::kFile, R_N, E_N, M(Track) }
, { "Formula", nullptr, MarkType::kFormula, R_O, E_N, M_ST | M(Method) | M_D }
, { "Formula", nullptr, MarkType::kFormula, R_O, E_N, M_ST | M(Member) | M(Method) | M_D }
, { "Function", nullptr, MarkType::kFunction, R_O, E_N, M(Example) }
, { "Height", nullptr, MarkType::kHeight, R_N, E_N, M(Example) }
, { "Image", nullptr, MarkType::kImage, R_N, E_N, M(Example) }
@ -1465,6 +1494,7 @@ public:
}
static KeyWord FindKey(const char* start, const char* end);
bool internalName(const Definition& ) const;
void keywordEnd();
void keywordStart(const char* keyword);
bool parseChar();
@ -1607,6 +1637,15 @@ public:
kChars,
};
struct IterState {
IterState (list<Definition>::iterator tIter, list<Definition>::iterator tIterEnd)
: fDefIter(tIter)
, fDefEnd(tIterEnd) {
}
list<Definition>::iterator fDefIter;
list<Definition>::iterator fDefEnd;
};
IncludeWriter() : IncludeParser() {}
~IncludeWriter() override {}
@ -1622,7 +1661,7 @@ public:
}
void enumHeaderOut(const RootDefinition* root, const Definition& child);
void enumMembersOut(const RootDefinition* root, const Definition& child);
void enumMembersOut(const RootDefinition* root, Definition& child);
void enumSizeItems(const Definition& child);
int lookupMethod(const PunctuationState punctuation, const Word word,
const int start, const int run, int lastWrite,
@ -1648,7 +1687,7 @@ public:
string resolveMethod(const char* start, const char* end, bool first);
string resolveRef(const char* start, const char* end, bool first);
Wrote rewriteBlock(int size, const char* data);
void structMemberOut(const Definition* memberStart, const Definition& child);
Definition* structMemberOut(const Definition* memberStart, const Definition& child);
void structOut(const Definition* root, const Definition& child,
const char* commentStart, const char* commentEnd);
void structSizeMembers(Definition& child);
@ -1656,6 +1695,7 @@ public:
private:
BmhParser* fBmhParser;
Definition* fDeferComment;
Definition* fLastComment;
const Definition* fBmhMethod;
const Definition* fEnumDef;
const Definition* fMethodDef;
@ -1665,6 +1705,7 @@ private:
int fEnumItemValueTab;
int fEnumItemCommentTab;
int fStructMemberTab;
int fStructValueTab;
int fStructCommentTab;
bool fInStruct;
@ -1752,6 +1793,7 @@ private:
void reset() override {
INHERITED::resetCommon();
fEnumClass = nullptr;
fMethod = nullptr;
fRoot = nullptr;
fTableState = TableState::kNone;
@ -1771,6 +1813,7 @@ private:
void resolveOut(const char* start, const char* end, BmhParser::Resolvable );
const BmhParser& fBmhParser;
const Definition* fEnumClass;
Definition* fMethod;
RootDefinition* fRoot;
TableState fTableState;

View File

@ -77,6 +77,9 @@ KeyWord IncludeParser::FindKey(const char* start, const char* end) {
}
++ch;
if (start + ch >= end) {
if (end - start < (int) strlen(kKeyWords[index].fName)) {
return KeyWord::kNone;
}
return kKeyWords[index].fKeyWord;
}
}
@ -230,10 +233,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
const Definition* def = root->find(fullName);
switch (token.fMarkType) {
case MarkType::kMethod: {
if (0 == token.fName.find("internal_")
|| 0 == token.fName.find("Internal_")
|| 0 == token.fName.find("legacy_")
|| 0 == token.fName.find("temporary_")) {
if (this->internalName(token)) {
continue;
}
const char* methodID = bmhParser.fMaps[(int) token.fMarkType].fName;
@ -833,6 +833,14 @@ bool IncludeParser::findComments(const Definition& includeDef, Definition* marku
return true;
}
bool IncludeParser::internalName(const Definition& token) const {
return 0 == token.fName.find("internal_")
|| 0 == token.fName.find("Internal_")
|| 0 == token.fName.find("legacy_")
|| 0 == token.fName.find("temporary_")
|| 0 == token.fName.find("private_");
}
// caller calls reportError, so just return false here
bool IncludeParser::parseClass(Definition* includeDef, IsStruct isStruct) {
SkASSERT(includeDef->fTokens.size() > 0);
@ -980,6 +988,9 @@ bool IncludeParser::parseEnum(Definition* child, Definition* markupDef) {
markupChild->fKeyWord = KeyWord::kEnum;
TextParser enumName(child);
enumName.skipExact("enum ");
if (enumName.skipExact("class ")) {
markupChild->fMarkType = MarkType::kEnumClass;
}
const char* nameStart = enumName.fChar;
enumName.skipToSpace();
markupChild->fName = markupDef->fName + "::" +
@ -1594,6 +1605,10 @@ bool IncludeParser::parseChar() {
}
if (Definition::Type::kKeyWord == fParent->fType
&& KeyProperty::kObject == (kKeyWords[(int) fParent->fKeyWord].fProperty)) {
if (KeyWord::kClass == fParent->fKeyWord && fParent->fParent &&
KeyWord::kEnum == fParent->fParent->fKeyWord) {
this->popObject();
}
if (KeyWord::kEnum == fParent->fKeyWord) {
fInEnum = false;
}

View File

@ -19,8 +19,19 @@ void IncludeWriter::enumHeaderOut(const RootDefinition* root,
const auto& nameDef = child.fTokens.front();
string fullName;
if (nullptr != nameDef.fContentEnd) {
string enumName(nameDef.fContentStart,
(int) (nameDef.fContentEnd - nameDef.fContentStart));
TextParser enumClassCheck(&nameDef);
const char* start = enumClassCheck.fStart;
size_t len = (size_t) (enumClassCheck.fEnd - start);
bool enumClass = enumClassCheck.skipExact("class ");
if (enumClass) {
start = enumClassCheck.fChar;
const char* end = enumClassCheck.anyOf(" \n;{");
len = (size_t) (end - start);
}
string enumName(start, len);
if (enumClass) {
child.fChildren[0]->fName = enumName;
}
fullName = root->fName + "::" + enumName;
enumDef = root->find(enumName);
if (!enumDef) {
@ -60,8 +71,10 @@ void IncludeWriter::enumHeaderOut(const RootDefinition* root,
!this->contentFree((int) (commentEnd - commentStart), commentStart)) {
this->writeCommentHeader();
this->writeString("\\enum");
this->writeSpace();
this->writeString(fullName.c_str());
if (fullName.length() > 0) {
this->writeSpace();
this->writeString(fullName.c_str());
}
fIndent += 4;
this->lfcr();
wroteHeader = true;
@ -88,7 +101,11 @@ void IncludeWriter::enumHeaderOut(const RootDefinition* root,
this->lfcr();
this->writeCommentTrailer();
}
bodyEnd = child.fChildren[0]->fContentStart;
Definition* braceHolder = child.fChildren[0];
if (KeyWord::kClass == braceHolder->fKeyWord) {
braceHolder = braceHolder->fChildren[0];
}
bodyEnd = braceHolder->fContentStart;
SkASSERT('{' == bodyEnd[0]);
++bodyEnd;
this->lfcr();
@ -99,7 +116,7 @@ void IncludeWriter::enumHeaderOut(const RootDefinition* root,
fEnumDef = enumDef;
}
void IncludeWriter::enumMembersOut(const RootDefinition* root, const Definition& child) {
void IncludeWriter::enumMembersOut(const RootDefinition* root, Definition& child) {
// iterate through include tokens and find how much remains for 1 line comments
// put ones that fit on same line, ones that are too big on preceding line?
const Definition* currentEnumItem = nullptr;
@ -113,10 +130,14 @@ void IncludeWriter::enumMembersOut(const RootDefinition* root, const Definition&
kItemComment,
};
State state = State::kNoItem;
// can't use (auto& token : child.fTokens) 'cause we need state one past end
auto tokenIter = child.fTokens.begin();
for (int onePast = 0; onePast < 2; onePast += tokenIter == child.fTokens.end()) {
const Definition* token = onePast ? nullptr : &*tokenIter++;
vector<IterState> iterStack;
iterStack.emplace_back(child.fTokens.begin(), child.fTokens.end());
IterState* iterState = &iterStack[0];
bool preprocessorWord = false;
const char* preprocessStart = nullptr;
const char* preprocessEnd = nullptr;
for (int onePast = 0; onePast < 2; onePast += iterState->fDefIter == iterState->fDefEnd) {
Definition* token = onePast ? nullptr : &*iterState->fDefIter++;
if (token && Definition::Type::kBracket == token->fType) {
if (Bracket::kSlashSlash == token->fBracket) {
fStart = token->fContentEnd;
@ -126,11 +147,31 @@ void IncludeWriter::enumMembersOut(const RootDefinition* root, const Definition&
fStart = token->fContentEnd + 1;
continue; // ignore old inline comments
}
if (Bracket::kPound == token->fBracket) { // preprocessor wraps member
preprocessStart = token->fContentStart;
if (KeyWord::kIf == token->fKeyWord || KeyWord::kIfdef == token->fKeyWord) {
iterStack.emplace_back(token->fTokens.begin(), token->fTokens.end());
iterState = &iterStack.back();
preprocessorWord = true;
} else if (KeyWord::kEndif == token->fKeyWord) {
iterStack.pop_back();
iterState = &iterStack.back();
preprocessEnd = token->fContentEnd;
} else {
SkASSERT(0); // incomplete
}
continue;
}
SkASSERT(0); // incomplete
}
if (token && Definition::Type::kWord != token->fType) {
SkASSERT(0); // incomplete
}
if (preprocessorWord) {
preprocessorWord = false;
preprocessEnd = token->fContentEnd;
continue;
}
if (token && State::kItemName == state) {
TextParser enumLine(token->fFileName, lastEnd,
token->fContentStart, token->fLineCount);
@ -172,6 +213,17 @@ void IncludeWriter::enumMembersOut(const RootDefinition* root, const Definition&
fIndent -= 4;
}
this->lfcr();
if (preprocessStart) {
SkASSERT(preprocessEnd);
int saveIndent = fIndent;
fIndent = SkTMax(0, fIndent - 8);
this->lf(2);
this->writeBlock((int) (preprocessEnd - preprocessStart), preprocessStart);
this->lfcr();
fIndent = saveIndent;
preprocessStart = nullptr;
preprocessEnd = nullptr;
}
if (token && State::kItemValue == state) {
fStart = token->fContentStart;
}
@ -182,8 +234,11 @@ void IncludeWriter::enumMembersOut(const RootDefinition* root, const Definition&
break;
}
SkASSERT(token);
string itemName = root->fName + "::" + string(token->fContentStart,
(int) (token->fContentEnd - token->fContentStart));
string itemName = root->fName + "::";
if (KeyWord::kClass == child.fParent->fKeyWord) {
itemName += child.fParent->fName + "::";
}
itemName += string(token->fContentStart, (int) (token->fContentEnd - token->fContentStart));
for (auto& enumItem : fEnumDef->fChildren) {
if (MarkType::kConst != enumItem->fMarkType) {
continue;
@ -251,8 +306,16 @@ void IncludeWriter::enumSizeItems(const Definition& child) {
const char* lastEnd = nullptr;
SkASSERT(child.fChildren.size() == 1 || child.fChildren.size() == 2);
auto brace = child.fChildren[0];
if (KeyWord::kClass == brace->fKeyWord) {
brace = brace->fChildren[0];
}
SkASSERT(Bracket::kBrace == brace->fBracket);
for (auto& token : brace->fTokens) {
vector<IterState> iterStack;
iterStack.emplace_back(brace->fTokens.begin(), brace->fTokens.end());
IterState* iterState = &iterStack[0];
bool preprocessorWord = false;
while (iterState->fDefIter != iterState->fDefEnd) {
auto& token = *iterState->fDefIter++;
if (Definition::Type::kBracket == token.fType) {
if (Bracket::kSlashSlash == token.fBracket) {
continue; // ignore old inline comments
@ -260,11 +323,28 @@ void IncludeWriter::enumSizeItems(const Definition& child) {
if (Bracket::kSlashStar == token.fBracket) {
continue; // ignore old inline comments
}
if (Bracket::kPound == token.fBracket) { // preprocessor wraps member
if (KeyWord::kIf == token.fKeyWord || KeyWord::kIfdef == token.fKeyWord) {
iterStack.emplace_back(token.fTokens.begin(), token.fTokens.end());
iterState = &iterStack.back();
preprocessorWord = true;
} else if (KeyWord::kEndif == token.fKeyWord) {
iterStack.pop_back();
iterState = &iterStack.back();
} else {
SkASSERT(0); // incomplete
}
continue;
}
SkASSERT(0); // incomplete
}
if (Definition::Type::kWord != token.fType) {
SkASSERT(0); // incomplete
}
if (preprocessorWord) {
preprocessorWord = false;
continue;
}
if (State::kItemName == state) {
TextParser enumLine(token.fFileName, lastEnd,
token.fContentStart, token.fLineCount);
@ -358,7 +438,31 @@ void IncludeWriter::methodOut(const Definition* method, const Definition& child)
}
commentStart = methodProp->fTerminator;
commentLen = (int) (method->fContentEnd - commentStart);
break;
break;
case MarkType::kExperimental:
this->writeString("EXPERIMENTAL:");
this->writeSpace();
commentStart = methodProp->fContentStart;
commentLen = (int) (methodProp->fContentEnd - commentStart);
if (commentLen > 0) {
if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart)) {
this->lfcr();
}
}
commentStart = methodProp->fTerminator;
commentLen = (int) (method->fContentEnd - commentStart);
break;
case MarkType::kToDo:
commentLen = (int) (methodProp->fStart - commentStart);
if (commentLen > 0) {
SkASSERT(commentLen < 1000);
if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart)) {
this->lfcr();
}
}
commentStart = methodProp->fTerminator;
commentLen = (int) (method->fContentEnd - commentStart);
break;
default:
commentLen = (int) (methodProp->fStart - commentStart);
breakOut = true;
@ -367,7 +471,7 @@ void IncludeWriter::methodOut(const Definition* method, const Definition& child)
break;
}
}
SkASSERT(commentLen > 0 && commentLen < 1000);
SkASSERT(commentLen > 0 && commentLen < 1500);
this->rewriteBlock(commentLen, commentStart);
// compute indention column
size_t column = 0;
@ -436,23 +540,40 @@ void IncludeWriter::structOut(const Definition* root, const Definition& child,
this->writeCommentTrailer();
}
void IncludeWriter::structMemberOut(const Definition* memberStart, const Definition& child) {
Definition* IncludeWriter::structMemberOut(const Definition* memberStart, const Definition& child) {
const char* blockStart = fDeferComment ? fLastComment->fContentEnd : fStart;
this->writeBlockTrim((int) (memberStart->fStart - blockStart), blockStart);
const char* commentStart = nullptr;
ptrdiff_t commentLen = 0;
string name(child.fContentStart, (int) (child.fContentEnd - child.fContentStart));
bool isShort;
Definition* commentBlock = nullptr;
for (auto memberDef : fStructDef->fChildren) {
if (memberDef->fName.length() - name.length() == memberDef->fName.find(name)) {
commentStart = memberDef->fContentStart;
commentLen = memberDef->fContentEnd - memberDef->fContentStart;
commentLen = memberDef->fContentEnd - commentStart;
isShort = memberDef->fShort;
commentBlock = memberDef;
SkASSERT(!isShort || memberDef->fChildren.size() == 0);
break;
}
}
if (!isShort) {
this->writeCommentHeader();
bool wroteLineFeed = false;
fIndent += 4;
bool wroteLineFeed = Wrote::kLF == this->rewriteBlock(commentLen, commentStart);
for (auto child : commentBlock->fChildren) {
commentLen = child->fStart - commentStart;
wroteLineFeed |= Wrote::kLF == this->rewriteBlock(commentLen, commentStart);
if (MarkType::kFormula == child->fMarkType) {
this->writeSpace();
this->writeBlock((int) (child->fContentEnd - child->fContentStart),
child->fContentStart);
}
commentStart = child->fTerminator;
}
commentLen = commentBlock->fContentEnd - commentStart;
wroteLineFeed |= Wrote::kLF == this->rewriteBlock(commentLen, commentStart);
fIndent -= 4;
if (wroteLineFeed || fColumn > 100 - 3 /* space * / */ ) {
this->lfcr();
@ -462,10 +583,25 @@ void IncludeWriter::structMemberOut(const Definition* memberStart, const Definit
this->writeCommentTrailer();
}
this->lfcr();
this->writeBlock((int) (memberStart->fContentEnd - memberStart->fContentStart),
this->writeBlock((int) (child.fStart - memberStart->fContentStart),
memberStart->fContentStart);
this->indentToColumn(fStructMemberTab);
this->writeString(name.c_str());
auto tokenIter = child.fParent->fTokens.begin();
std::advance(tokenIter, child.fParentIndex + 1);
Definition* valueStart = &*tokenIter;
while (Definition::Type::kPunctuation != tokenIter->fType) {
std::advance(tokenIter, 1);
SkASSERT(child.fParent->fTokens.end() != tokenIter);
}
Definition* valueEnd = &*tokenIter;
if (valueStart != valueEnd) {
this->indentToColumn(fStructValueTab);
this->writeString("=");
this->writeSpace();
this->writeBlock((int) (valueEnd->fStart - valueStart->fContentStart),
valueStart->fContentStart);
}
this->writeString(";");
if (isShort) {
this->indentToColumn(fStructCommentTab);
@ -474,14 +610,18 @@ void IncludeWriter::structMemberOut(const Definition* memberStart, const Definit
this->rewriteBlock(commentLen, commentStart);
this->lfcr();
}
return valueEnd;
}
void IncludeWriter::structSizeMembers(Definition& child) {
int longestType = 0;
Definition* typeStart = nullptr;
int longestName = 0;
int longestValue = 0;
SkASSERT(child.fChildren.size() == 1 || child.fChildren.size() == 2);
bool inEnum = false;
bool inMethod = false;
bool inMember = false;
auto brace = child.fChildren[0];
SkASSERT(Bracket::kBrace == brace->fBracket);
for (auto& token : brace->fTokens) {
@ -493,6 +633,9 @@ void IncludeWriter::structSizeMembers(Definition& child) {
continue; // ignore old inline comments
}
if (Bracket::kParen == token.fBracket) {
if (inMethod) {
continue;
}
break;
}
SkASSERT(0); // incomplete
@ -525,6 +668,20 @@ void IncludeWriter::structSizeMembers(Definition& child) {
SkASSERT(Punctuation::kSemicolon == token.fPunctuation);
inEnum = false;
}
if (inMethod) {
if (Punctuation::kColon == token.fPunctuation) {
inMethod = false;
} else if (Punctuation::kLeftBrace == token.fPunctuation) {
inMethod = false;
} else {
SkASSERT(0); // incomplete
}
}
if (inMember) {
SkASSERT(Punctuation::kSemicolon == token.fPunctuation);
typeStart = nullptr;
inMember = false;
}
continue;
}
if (Definition::Type::kWord != token.fType) {
@ -534,19 +691,33 @@ void IncludeWriter::structSizeMembers(Definition& child) {
TextParser typeStr(token.fFileName, typeStart->fContentStart, token.fContentStart,
token.fLineCount);
typeStr.trimEnd();
longestType = SkTMax(longestType, (int) (typeStr.fEnd - typeStart->fContentStart));
longestType = SkTMax(longestType, (int) (typeStr.fEnd - typeStr.fStart));
longestName = SkTMax(longestName, (int) (token.fContentEnd - token.fContentStart));
typeStart->fMemberStart = true;
typeStart = nullptr;
inMember = true;
continue;
}
if (MarkType::kMethod == token.fMarkType) {
inMethod = true;
continue;
}
SkASSERT(MarkType::kNone == token.fMarkType);
if (!typeStart) {
if (typeStart) {
if (inMember) {
longestValue =
SkTMax(longestValue, (int) (token.fContentEnd - token.fContentStart));
}
} else {
typeStart = &token;
}
}
fStructMemberTab = longestType + fIndent + 1 /* space before name */ ;
fStructCommentTab = fStructMemberTab + longestName + 2 /* ; space */ ;
fStructValueTab = fStructMemberTab + longestName + 2 /* space ; */ ;
fStructCommentTab = fStructValueTab;
if (longestValue) {
fStructCommentTab += longestValue + 3 /* space = space */ ;
fStructValueTab -= 1 /* ; */ ;
}
// iterate through bmh children and see which comments fit on include lines
for (auto& member : fStructDef->fChildren) {
if (MarkType::kMember != member->fMarkType) {
@ -574,9 +745,18 @@ bool IncludeWriter::populate(Definition* def, RootDefinition* root) {
const Definition* method;
const Definition* clonedMethod = nullptr;
const Definition* memberStart = nullptr;
const Definition* memberEnd = nullptr;
fContinuation = nullptr;
bool inStruct = false;
bool inConstructor = false;
for (auto& child : def->fTokens) {
if (memberEnd) {
if (memberEnd != &child) {
continue;
}
fStart = child.fContentStart + 1;
memberEnd = nullptr;
}
if (child.fPrivate) {
continue;
}
@ -588,6 +768,9 @@ bool IncludeWriter::populate(Definition* def, RootDefinition* root) {
}
if (Definition::Type::kBracket == child.fType && Bracket::kParen == child.fBracket) {
if (!clonedMethod) {
if (inConstructor) {
fContinuation = child.fContentStart;
}
continue;
}
int alternate = 1;
@ -598,8 +781,7 @@ bool IncludeWriter::populate(Definition* def, RootDefinition* root) {
TextParser params(clonedMethod->fFileName, clonedMethod->fStart,
clonedMethod->fContentStart, clonedMethod->fLineCount);
params.skipToEndBracket('(');
if (params.fEnd - params.fChar >= childLen &&
!strncmp(params.fChar, child.fContentStart, childLen)) {
if (params.startsWith(child.fContentStart, childLen)) {
this->methodOut(clonedMethod, child);
break;
}
@ -643,9 +825,12 @@ bool IncludeWriter::populate(Definition* def, RootDefinition* root) {
this->methodOut(method, child);
continue;
}
if (inConstructor) {
continue;
}
methodName += "()";
method = root->find(methodName);
if (MarkType::kDefinedBy == method->fMarkType) {
if (method && MarkType::kDefinedBy == method->fMarkType) {
method = method->fParent;
}
if (method) {
@ -660,9 +845,13 @@ bool IncludeWriter::populate(Definition* def, RootDefinition* root) {
if (!fDeferComment) {
fDeferComment = &child;
}
fLastComment = &child;
continue;
}
if (MarkType::kMethod == child.fMarkType) {
if (this->internalName(child)) {
continue;
}
const char* bodyEnd = fDeferComment ? fDeferComment->fContentStart - 1 :
child.fContentStart;
// FIXME: roll end-trimming into writeBlockTrim call
@ -675,6 +864,7 @@ bool IncludeWriter::populate(Definition* def, RootDefinition* root) {
}
fStart = child.fContentStart;
methodName = root->fName + "::" + child.fName;
inConstructor = root->fName == child.fName;
fContinuation = child.fContentEnd;
method = root->find(methodName);
if (!method) {
@ -732,6 +922,13 @@ bool IncludeWriter::populate(Definition* def, RootDefinition* root) {
if (nullptr == structDef) {
structDef = root->find(root->fName + "::" + child.fName);
}
if (!structDef) {
this->lf(2);
fIndent = 0;
this->writeBlock((int) (fStart - bodyEnd), bodyEnd);
this->lfcr();
continue;
}
Definition* codeBlock = nullptr;
Definition* nextBlock = nullptr;
for (auto test : structDef->fChildren) {
@ -756,7 +953,7 @@ bool IncludeWriter::populate(Definition* def, RootDefinition* root) {
}
break;
case KeyWord::kEnum: {
this->fInEnum = true;
fInEnum = true;
this->enumHeaderOut(root, child);
this->enumSizeItems(child);
} break;
@ -777,6 +974,7 @@ bool IncludeWriter::populate(Definition* def, RootDefinition* root) {
case KeyWord::kPrivate:
case KeyWord::kProtected:
case KeyWord::kFriend:
case KeyWord::kTypedef:
break;
default:
SkASSERT(0);
@ -795,21 +993,27 @@ bool IncludeWriter::populate(Definition* def, RootDefinition* root) {
const char* structEnd = child.fContentEnd;
SkAssertResult('}' == structEnd[-1]);
--structEnd;
this->writeBlock((int) (structEnd - fStart), fStart);
this->writeBlockTrim((int) (structEnd - fStart), fStart);
this->lf(2);
fStart = structEnd;
fIndent -= 4;
fContinuation = nullptr;
fDeferComment = nullptr;
} else {
if (!this->populate(&child, root)) {
if (fInEnum && KeyWord::kClass == child.fChildren[0]->fKeyWord) {
if (!this->populate(child.fChildren[0], root)) {
return false;
}
} else if (!this->populate(&child, root)) {
return false;
}
}
continue;
}
if (Definition::Type::kBracket == child.fType) {
if (KeyWord::kEnum == child.fParent->fKeyWord) {
if (KeyWord::kEnum == child.fParent->fKeyWord ||
(KeyWord::kClass == child.fParent->fKeyWord && child.fParent->fParent &&
KeyWord::kEnum == child.fParent->fParent->fKeyWord)) {
this->enumMembersOut(root, child);
this->writeString("};");
this->lf(2);
@ -828,7 +1032,7 @@ bool IncludeWriter::populate(Definition* def, RootDefinition* root) {
}
if (Definition::Type::kWord == child.fType) {
if (MarkType::kMember == child.fMarkType) {
this->structMemberOut(memberStart, child);
memberEnd = this->structMemberOut(memberStart, child);
fStart = child.fContentEnd + 1;
fDeferComment = nullptr;
}
@ -953,6 +1157,12 @@ string IncludeWriter::resolveRef(const char* start, const char* end, bool first)
rootDefIter = fBmhParser->fTopicMap.find(prefixedName);
if (fBmhParser->fTopicMap.end() != rootDefIter) {
rootDef = rootDefIter->second;
} else if (fStructDef) {
string localPrefix = fStructDef->fFiddle + '_' + undername;
rootDefIter = fBmhParser->fTopicMap.find(localPrefix);
if (fBmhParser->fTopicMap.end() != rootDefIter) {
rootDef = rootDefIter->second;
}
} else {
auto aliasIter = fBmhParser->fAliasMap.find(undername);
if (fBmhParser->fAliasMap.end() != aliasIter) {

View File

@ -140,7 +140,8 @@ string MdOut::addReferences(const char* refStart, const char* refEnd,
&& string::npos != ref.find_first_of("ABCDEFGHIJKLMNOPQRSTUVWXYZ")) {
// FIXME: see isDefined(); check to see if fXX is a member of xx.fXX
if (('f' != ref[0] && string::npos == ref.find("()"))
|| '.' != t.backup(ref.c_str())) {
// || '.' != t.backup(ref.c_str())
&& ('k' != ref[0] && string::npos == ref.find("_Private"))) {
if (BmhParser::Resolvable::kOut != resolvable) {
t.reportError("missed camelCase");
return result;
@ -284,6 +285,8 @@ void MdOut::childrenOut(const Definition* def, const char* start) {
fLineCount = def->fLineCount;
if (def->isRoot()) {
fRoot = const_cast<RootDefinition*>(def->asRoot());
} else if (MarkType::kEnumClass == def->fMarkType) {
fEnumClass = def;
}
BmhParser::Resolvable resolvable = this->resolvable(def->fMarkType);
for (auto& child : def->fChildren) {
@ -298,6 +301,9 @@ void MdOut::childrenOut(const Definition* def, const char* start) {
end = def->fContentEnd;
this->resolveOut(start, end, resolvable);
}
if (MarkType::kEnumClass == def->fMarkType) {
fEnumClass = nullptr;
}
}
const Definition* MdOut::isDefined(const TextParser& parser, const string& ref, bool report) const {
@ -389,6 +395,18 @@ const Definition* MdOut::isDefined(const TextParser& parser, const string& ref,
return &iter.second;
}
}
if (fEnumClass) {
string fullName = fEnumClass->fName + "::" + ref;
for (auto child : fEnumClass->fChildren) {
if (fullName == child->fName) {
return child;
}
}
}
if (string::npos != ref.find("_Private")) {
return nullptr;
}
SkDebugf("");
}
if ('f' == ref[0]) {
// FIXME : find def associated with prior, e.g.: r.fX where 'SkPoint r' was earlier