generate include comments

- formalize how aliases and substitutions work together
- add constexpr, #define, typedef support
- check for correct description order
- write short enum, struct members

R=caryclark@google.com

Docs-Preview: https://skia.org/?cl=129455
Bug: skia:6898
Change-Id: Id60fc2ed02f38a7ba4e5cad5ef493d8c674e6183
Reviewed-on: https://skia-review.googlesource.com/129455
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
This commit is contained in:
Cary Clark 2018-05-30 09:21:49 -04:00 committed by Skia Commit-Bot
parent 594b64c485
commit 137b874855
30 changed files with 611 additions and 300 deletions

View File

@ -1,6 +1,6 @@
#Topic Bitmap
#Alias Bitmaps
#Alias Bitmap_Reference
#Alias Bitmaps ##
#Alias Bitmap_Reference ##
#Class SkBitmap
@ -11,7 +11,7 @@ Bitmap points to Pixel_Ref, which describes the physical array of pixels.
Image_Info bounds may be located anywhere fully inside Pixel_Ref bounds.
Bitmap can be drawn using Canvas. Bitmap can be a drawing destination for Canvas
draw member functionss. Bitmap flexibility as a pixel container limits some
draw member functions. Bitmap flexibility as a pixel container limits some
optimizations available to the target platform.
If pixel array is primarily read-only, use Image for better performance.

View File

@ -1,5 +1,5 @@
#Topic Canvas
#Alias Canvas_Reference
#Alias Canvas_Reference ##
#Class SkCanvas
@ -1463,6 +1463,8 @@ depth = 1
#Subtopic Layer
#Substitute layer
#Alias Layers
#Substitute layers
##
#Line # temporary Bitmap to draw into ##
Layer allocates a temporary Bitmap to draw into. When the drawing is
@ -1691,13 +1693,12 @@ Call restoreToCount with returned value to restore this and subsequent saves.
#Typedef uint32_t SaveLayerFlags
#Line # options for SaveLayerRec ##
##
SaveLayerFlags provides options that may be used in any combination in SaveLayerRec,
defining how Layer allocated by saveLayer operates. It may be set to zero,
kPreserveLCDText_SaveLayerFlag, kInitWithPrevious_SaveLayerFlag, or both flags.
##
#Const kPreserveLCDText_SaveLayerFlag 2
#Line # creates Layer for LCD text ##
Creates Layer for LCD text. Flag is ignored if Layer Paint contains
@ -1751,8 +1752,6 @@ void draw(SkCanvas* canvas) {
#Struct SaveLayerRec
#Line # contains the state used to create the Layer ##
SaveLayerRec contains the state used to create the Layer.
#Code
struct SaveLayerRec {
SaveLayerRec*(...
@ -1764,6 +1763,8 @@ SaveLayerRec contains the state used to create the Layer.
};
##
SaveLayerRec contains the state used to create the Layer.
#Subtopic Overview
#Populate
##
@ -2502,7 +2503,7 @@ The clip restriction is not recorded in pictures.
Pass an empty rect to disable maximum clip.
#Private
This is private API to be used only by Android framework.
This private API is for use by Android framework only.
##
#Param rect maximum allowed clip in device coordinates
@ -4401,9 +4402,7 @@ are larger than dst; center and four sides are scaled to fit remaining space, if
Additionally transform draw using Clip, Matrix, and optional Paint paint.
If Paint paint is supplied, apply Color_Filter, Color_Alpha, Image_Filter,
Blend_Mode, and Draw_Looper. If image is kAlpha_8_SkColorType, apply Shader.
If paint contains Mask_Filter, generate mask from image bounds.
#paint_as_used_by_draw_lattice_or_draw_nine(image)#
If generated mask extends beyond image bounds, replicate image edge colors, just
as Shader made from SkImage::makeShader with SkShader::kClamp_TileMode set
@ -4690,7 +4689,7 @@ Blend_Mode, and Draw_Looper. If #bitmap_or_image# is kAlpha_8_SkColorType, apply
If paint contains Mask_Filter, generate mask from #bitmap_or_image# bounds. If paint
Filter_Quality set to kNone_SkFilterQuality, disable pixel filtering. For all
other values of paint Filter_Quality, use kLow_SkFilterQuality to filter pixels.
Any SkMaskFilter on the paint is ignored as is the paint's antialiasing state.
Any SkMaskFilter on paint is ignored as is paint Anti_Aliasing state.
##
#Method void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
@ -4767,14 +4766,6 @@ void draw(SkCanvas* canvas) {
#Struct Lattice
#Line # divides Bitmap or Image into a rectangular grid ##
Lattice divides Bitmap or Image into a rectangular grid.
Grid entries on even columns and even rows are fixed; these entries are
always drawn at their original size if the destination is large enough.
If the destination side is too small to hold the fixed entries, all fixed
entries are proportionately scaled down to fit.
The grid entries not on even columns and rows are scaled to fit the
remaining space, if any.
#Code
struct Lattice {
enum RectType ...
@ -4789,6 +4780,14 @@ remaining space, if any.
};
##
Lattice divides Bitmap or Image into a rectangular grid.
Grid entries on even columns and even rows are fixed; these entries are
always drawn at their original size if the destination is large enough.
If the destination side is too small to hold the fixed entries, all fixed
entries are proportionately scaled down to fit.
The grid entries not on even columns and rows are scaled to fit the
remaining space, if any.
#Subtopic Overview
#Populate
##
@ -5192,7 +5191,7 @@ Paint paint. The number of entries in pos array must match the number of Glyphs
described by byteLength of text.
text meaning depends on Paint_Text_Encoding; by default, text is encoded as
UTF-8. pos elements' meaning depends on Paint_Text_Align and Paint_Vertical_Text;
UTF-8. pos elements meaning depends on Paint_Vertical_Text;
by default each glyph left side bearing is positioned at x and its
baseline is positioned at y. Text size is affected by Matrix and
Paint_Text_Size.
@ -5238,7 +5237,7 @@ constY, using Clip, Matrix, and Paint paint. The number of entries in xpos array
must match the number of Glyphs described by byteLength of text.
text meaning depends on Paint_Text_Encoding; by default, text is encoded as
UTF-8. xpos elements' meaning depends on Paint_Text_Align and Paint_Vertical_Text;
UTF-8. xpos elements meaning depends on Paint_Vertical_Text;
by default each glyph left side bearing is positioned at an xpos element and
its baseline is positioned at constY. Text size is affected by Matrix and
Paint_Text_Size.
@ -5332,21 +5331,22 @@ filled 12 point black Glyphs.
Draw text on Path path, using Clip, Matrix, and Paint paint.
Origin of text is at beginning of path offset by matrix, if not nullptr.
matrix also transforms text before text is mapped to path. If the path section
matrix transforms text before text is mapped to path. If the path section
corresponding the glyph advance is curved, the glyph is drawn curved to match;
control points in the glyph are mapped to projected points parallel to the path.
If the text advance is larger than the path length, the excess text is clipped.
matrix does not effect paint Shader.
text meaning depends on Paint_Text_Encoding; by default, text is encoded as
UTF-8. Origin meaning depends on Paint_Text_Align and Paint_Vertical_Text; by
default text positions the first glyph left side bearing at origin x and its
baseline at origin y. Text size is affected by matrix parameter, Canvas_Matrix,
baseline at origin y. Text size is affected by matrix parameter, Canvas Matrix,
and Paint_Text_Size.
All elements of paint: Path_Effect, Mask_Filter, Shader,
Color_Filter, Image_Filter, and Draw_Looper; apply to text. By default, draws
filled 12 point black Glyphs. Canvas Matrix does effect paint Shader, but
matrix parameter does not.
filled 12 point black Glyphs.
#Param text character code points or Glyphs drawn ##
#Param byteLength byte length of text array ##
@ -5391,8 +5391,8 @@ matrix parameter does not.
Draw text, transforming each glyph by the corresponding SkRSXform,
using Clip, Matrix, and Paint paint.
RSXform array specifies a separate square scale, rotation, and translation for
each glyph.
RSXform xform array specifies a separate square scale, rotation, and translation
for each glyph. xform does not affect paint Shader.
Optional Rect cullRect is a conservative bounds of text, taking into account
RSXform and paint. If cullRect is outside of Clip, canvas can skip drawing.

View File

@ -1,5 +1,5 @@
#Topic Color4f
#Alias Color4f_Reference
#Alias Color4f_Reference ##
#Struct SkColor4f

View File

@ -1,5 +1,5 @@
#Topic Color
#Alias Color_Reference
#Alias Color_Reference ##
#Subtopic Overview
#Populate
@ -36,7 +36,9 @@ floating point values. Unsigned integer Alpha ranges from zero, fully
transparent, to all bits set, fully opaque. Floating point Alpha ranges from
zero, fully transparent, to one, fully opaque.
#Alias Alpha
#Alias Alpha
#Substitute alpha
##
#Typedef uint8_t SkAlpha
#Line # defines Alpha as eight bits ##

View File

@ -1,6 +1,6 @@
#Topic IPoint
#Alias IPoints
#Alias IPoint_Reference
#Alias IPoints ##
#Alias IPoint_Reference ##
#Struct SkIPoint
@ -454,15 +454,15 @@ Can also be used to add IVector to IVector, returning IVector.
#Subtopic IVector
#Line # alias for IPoint ##
#Alias IVector
#Alias IVectors
#Alias IVector ##
#Alias IVectors ##
#Typedef SkIPoint SkIVector
#Line # alias for IPoint ##
#Code
typedef SkIPoint SkIVector;
##
SkIVector provides an alternative name for SkIPoint. SkIVector and SkIPoint
can be used interchangably for all purposes.
can be used interchangeably for all purposes.
#Typedef ##
##

View File

@ -1,6 +1,6 @@
#Topic IRect
#Alias IRects
#Alias IRect_Reference
#Alias IRects ##
#Alias IRect_Reference ##
#Struct SkIRect

View File

@ -1,5 +1,5 @@
#Topic Image_Info
#Alias Image_Info_Reference
#Alias Image_Info_Reference ##
Image_Info specifies the dimensions and encoding of the pixels in a Bitmap.
The dimensions are integral width and height. The encoding is how pixel
@ -22,8 +22,8 @@ but Image and Surface may not contain Image_Info.
# ------------------------------------------------------------------------------
#Subtopic Alpha_Type
#Line # encoding for pixel transparency ##
#Alias Alpha_Type
#Alias Alpha_Types
#Alias Alpha_Type ##
#Alias Alpha_Types ##
#PhraseDef list_of_alpha_types
kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
@ -224,8 +224,8 @@ opaque, then the result of drawing any pixel with a Color_Alpha value less than
# ------------------------------------------------------------------------------
#Subtopic Color_Type
#Line # encoding for pixel color ##
#Alias Color_Type
#Alias Color_Types
#Alias Color_Type ##
#Alias Color_Types ##
#PhraseDef list_of_color_types
kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,
@ -265,7 +265,7 @@ $$$#
#Code ##
Describes how pixel bits encode color. A pixel may be an alpha mask, a
grayscale, RGB, or ARGB.
Grayscale, RGB, or ARGB.
kN32_SkColorType selects the native 32-bit ARGB format. On Little_Endian
processors, pixels containing 8-bit ARGB components pack into 32-bit
@ -335,7 +335,7 @@ kRGBA_8888_SkColorType.
##
#Const kGray_8_SkColorType 9
#Line # pixel with grayscale level in 8-bit byte ##
#Line # pixel with Grayscale level in 8-bit byte ##
#Details Gray_8
Stores 8-bit byte pixel encoding that equivalent to equal values for red,
blue, and green, representing colors from black to white.
@ -355,7 +355,7 @@ kRGBA_8888_SkColorType.
##
#Const kN32_SkColorType 4 or 6
#Alias Native_Color_Type
#Alias Native_Color_Type ##
#NoJustify
#Line # native ARGB 32-bit encoding ##
Encodes ARGB as either kRGBA_8888_SkColorType or
@ -733,8 +733,8 @@ kRGBA_8888_SkColorType.
##
#Subtopic Gray_8
#Line # encodes level of grayscale in 8 bits ##
kGray_8_SkColorType encodes grayscale level in eight bits that is equivalent
#Line # encodes level of Grayscale in 8 bits ##
kGray_8_SkColorType encodes Grayscale level in eight bits that is equivalent
to equal values for red, blue, and green, representing colors from black to
white. Pixels described by kGray_8_SkColorType are fully
opaque as if its Color_Alpha was set to one, and should always be paired with
@ -980,7 +980,8 @@ and return true if alphaType is not kUnknown_SkAlphaType.
# ------------------------------------------------------------------------------
#Subtopic YUV_ColorSpace
#Line # color range of YUV pixels ##
#Alias YUV_ColorSpace
#Alias YUV_ColorSpace ##
#Enum SkYUVColorSpace
#Line # color range of YUV pixels ##
@ -1037,7 +1038,6 @@ with studio range of 16 to 235 range for components.
# ------------------------------------------------------------------------------
#Struct SkImageInfo
Describes pixel dimensions and encoding. Bitmap, Image, PixMap, and Surface

View File

@ -1,5 +1,5 @@
#Topic Image
#Alias Image_Reference
#Alias Image_Reference ##
#Class SkImage
@ -19,7 +19,7 @@ include BMP, GIF, HEIF, ICO, JPEG, PNG, WBMP, WebP. Supported encoding details
vary with platform.
#Subtopic Raster_Image
#Alias Raster_Image
#Alias Raster_Image ##
#Line # pixels decoded in Raster_Bitmap ##
Raster_Image pixels are decoded in a Raster_Bitmap. These pixels may be read
directly and in most cases written to, although edited pixels may not be drawn

View File

@ -1,6 +1,6 @@
#Topic Matrix
#Alias Matrices
#Alias Matrix_Reference
#Alias Matrices ##
#Alias Matrix_Reference ##
#Class SkMatrix

View File

@ -1,5 +1,5 @@
#Topic Paint
#Alias Paint_Reference
#Alias Paint_Reference ##
#Class SkPaint
@ -440,8 +440,8 @@ as the Font_Engine.
gray-level rendering.
##
#Const kFull_Hinting 3
#Line # modifies glyph outlines for maxiumum constrast ##
Modifies glyph outlines for maxiumum constrast. With FreeType, this selects
#Line # modifies glyph outlines for maximum constrast ##
Modifies glyph outlines for maximum constrast. With FreeType, this selects
FT_LOAD_TARGET_LCD or FT_LOAD_TARGET_LCD_V if kLCDRenderText_Flag is set.
FT_LOAD_TARGET_LCD is a variant of FT_LOAD_TARGET_NORMAL optimized for
horizontally decimated LCD displays; FT_LOAD_TARGET_LCD_V is a
@ -450,9 +450,9 @@ as the Font_Engine.
#Bug 915
On OS_X and iOS, hinting controls whether Core_Graphics dilates the font outlines
to account for LCD text. No hinting uses Core_Text gray scale output.
to account for LCD text. No hinting uses Core_Text Grayscale output.
Normal hinting uses Core_Text LCD output. If kLCDRenderText_Flag is clear,
the LCD output is reduced to a single grayscale channel.
the LCD output is reduced to a single Grayscale channel.
On Windows with DirectWrite, Hinting has no effect.
@ -650,11 +650,14 @@ All Flags members may be cleared, or one or more may be set.
# ------------------------------------------------------------------------------
#Subtopic Anti_Alias
#Alias Anti_Alias
#Substitute Anti-alias
#Substitute anti-alias
##
#Alias Anti_Aliased
#Substitute Anti-aliased
#Substitute anti-aliased
##
#Alias Anti_Aliasing
#Substitute Anti-aliasing
#Substitute anti-aliasing
##
#In Related_Function
#Line # approximating coverage with transparency ##
@ -948,7 +951,7 @@ kLCDRenderText_Flag or kSubpixelText_Flag (or both) at compile time.
#Subtopic Device_Text ##
#Subtopic Linear_Text
#Alias Linear_Text
#Alias Linear_Text ##
#Line # selects text rendering as Glyph or Path ##
Linear_Text selects whether text is rendered as a Glyph or as a Path.
@ -1025,7 +1028,7 @@ If kLinearText_Flag is clear, it is the same as setting Hinting to kNo_Hinting.
#Subtopic Linear_Text ##
#Subtopic Subpixel_Text
#Alias Subpixel_Text
#Alias Subpixel_Text ##
#Line # uses pixel transparency to represent fractional offset ##
Flags kSubpixelText_Flag uses the pixel transparency to represent a fractional offset.
@ -1085,9 +1088,12 @@ SkDebugf("paint.isSubpixelText() %c= !!(paint.getFlags() & SkPaint::kSubpixelTex
#Subtopic Subpixel_Text ##
#Subtopic LCD_Text
#Substitute LCD text
#Line # text relying on the order of RGB stripes ##
#Alias LCD_Text # makes this a top level name, since it is under subtopic Device_Text
# make this a top level name, since it is under subtopic Device_Text
#Alias LCD_Text
#Substitute LCD text
##
When set, Flags kLCDRenderText_Flag takes advantage of the organization of RGB stripes that
create a color, and relies
@ -1151,7 +1157,7 @@ SkDebugf("paint.isLCDRenderText() %c= !!(paint.getFlags() & SkPaint::kLCDRenderT
# ------------------------------------------------------------------------------
#Subtopic Font_Embedded_Bitmaps
#Line # custom sized bitmap Glyphs ##
#Alias Font_Embedded_Bitmaps # long-winded enough, alias so I don't type Paint_Font_...
#Alias Font_Embedded_Bitmaps ## # long-winded enough, alias so I don't type Paint_Font_...
Font_Embedded_Bitmaps allows selecting custom sized bitmap Glyphs.
Flags kEmbeddedBitmapText_Flag when set chooses an embedded bitmap glyph over an outline contained
@ -1515,7 +1521,7 @@ void draw(SkCanvas* canvas) {
# ------------------------------------------------------------------------------
#Subtopic Full_Hinting_Spacing
#Line # glyph spacing affected by hinting ##
#Alias Full_Hinting_Spacing # long winded enough -- maybe things with two underscores auto-aliased?
#Alias Full_Hinting_Spacing ## # long winded enough -- maybe things with two underscores auto-aliased?
if Hinting is set to kFull_Hinting, Full_Hinting_Spacing adjusts the character
spacing by the difference of the hinted and Unhinted Left_Side_Bearing and
@ -1834,7 +1840,7 @@ may have gaps, and if kAntiAlias_Flag is set, Color_Alpha will increase to visua
#Subtopic Hairline
#Line # lines and curves with minimal width ##
#Alias Hairline # maybe should be Stroke_Hairline ?
#Alias Hairline ## # maybe should be Stroke_Hairline ?
Stroke_Width of zero has a special meaning and switches drawing to use Hairline.
Hairline draws the thinnest continuous frame. If kAntiAlias_Flag is clear, adjacent pixels
@ -3494,6 +3500,7 @@ Align defaults to kLeft_Align.
#Const kAlignCount 3
#Line # number of different Text_Align values defined ##
May be used to verify that Align is a legal value.
##
#Enum ##
@ -5053,7 +5060,7 @@ Paint may draw to.
if (!path.isInverseFillType() && paint.canComputeFastBounds()) {
SkRect storage;
if (canvas->quickReject(paint.computeFastBounds(path.getBounds(), &storage))) {
return; // don't draw the path
return; // do not draw the path
}
}
// draw the path

View File

@ -1,6 +1,6 @@
#Topic Path
#Alias Path_Reference
#Alias Paths
#Alias Path_Reference ##
#Alias Paths ##
Path contains Lines and Curves which can be stroked or filled. Contour is
composed of a series of connected Lines and Curves. Path may contain zero,
@ -76,7 +76,7 @@ a new Path independent of the original. Internally, the copy does not duplicate
its contents until it is edited, to reduce memory use and improve performance.
#Subtopic Contour
#Alias Contours
#Alias Contours ##
#Line # loop of lines and curves ##
Contour contains one or more Verbs, and as many Points as
@ -135,7 +135,7 @@ void draw(SkCanvas* canvas) {
##
#Subtopic Zero_Length
#Alias Zero_Length_Contour
#Alias Zero_Length_Contour ##
#Line # consideration when contour has no length ##
Contour length is distance traveled from first Point to Last_Point,
plus, if Contour is closed, distance from Last_Point to first Point.
@ -214,7 +214,7 @@ SkPath::updateBoundsCache to make Path thread safe.
##
#Subtopic Verb
#Alias Verbs
#Alias Verbs ##
#Line # line and curve type ##
#Enum Verb
#Line # controls how Path Points are interpreted ##
@ -326,7 +326,7 @@ verbs: kMove_Verb kLine_Verb kQuad_Verb kClose_Verb kMove_Verb kCubic_Verb kConi
# ------------------------------------------------------------------------------
#Subtopic Direction
#Line # contour orientation, clockwise or counterclockwise ##
#Alias Directions
#Alias Directions ##
#Enum Direction
#Line # sets Contour clockwise or counterclockwise ##
@ -2316,10 +2316,10 @@ void draw(SkCanvas* canvas) {
# ------------------------------------------------------------------------------
#Subtopic Quad
#Alias Quad
#Alias Quads
#Alias Quadratic_Bezier
#Alias Quadratic_Beziers
#Alias Quad ##
#Alias Quads ##
#Alias Quadratic_Bezier ##
#Alias Quadratic_Beziers ##
#Line # curve described by second-order polynomial ##
Quad describes a quadratic Bezier, a second-order curve identical to a section
@ -2491,7 +2491,7 @@ void draw(SkCanvas* canvas) {
#Subtopic Conic
#Line # conic section defined by three points and a weight ##
#Alias Conics
#Alias Conics ##
Conic describes a conical section: a piece of an ellipse, or a piece of a
parabola, or a piece of a hyperbola. Conic begins at a start Point,
@ -2502,8 +2502,8 @@ Each Conic in Path adds two Points and one Conic_Weight. Conic_Weights in Path
may be inspected with Iter, or with RawIter.
#Subtopic Weight
#Alias Conic_Weights
#Alias Weights
#Alias Conic_Weights ##
#Alias Weights ##
#Line # strength of Conic control Point ##
Weight determines both the strength of the control Point and the type of Conic.
@ -2512,7 +2512,7 @@ have no effect; Conic is identical to a line segment from start Point to end
point. If Weight is less than one, Conic follows an elliptical arc.
If Weight is exactly one, then Conic is identical to Quad; Conic follows a
parabolic arc. If Weight is greater than one, Conic follows a hyperbolic
arc. If Weight is infinity, Conic is indentical to two line segments, connecting
arc. If Weight is infinity, Conic is identical to two line segments, connecting
start Point to control Point, and control Point to end Point.
#Example
@ -2788,10 +2788,10 @@ void draw(SkCanvas* canvas) {
# ------------------------------------------------------------------------------
#Subtopic Cubic
#Alias Cubic
#Alias Cubics
#Alias Cubic_Bezier
#Alias Cubic_Beziers
#Alias Cubic ##
#Alias Cubics ##
#Alias Cubic_Bezier ##
#Alias Cubic_Beziers ##
#Line # curve described by third-order polynomial ##
Cubic describes a Bezier_Curve segment described by a third-order polynomial.
@ -5266,7 +5266,7 @@ length = 40; returned by readFromMemory = 36
# ------------------------------------------------------------------------------
#Subtopic Generation_ID
#Alias Generation_IDs
#Alias Generation_IDs ##
#Line # value reflecting contents change ##
Generation_ID provides a quick way to check if Verb_Array, Point_Array, or
Conic_Weight has changed. Generation_ID is not a hash; identical Paths will
@ -5339,10 +5339,6 @@ empty genID = 1
#Class Iter
#Line # data iterator ##
Iterates through Verb_Array, and associated Point_Array and Conic_Weight.
Provides options to treat open Contours as closed, and to ignore
degenerate data.
#Code
class Iter {
public:
@ -5356,6 +5352,10 @@ public:
};
##
Iterates through Verb_Array, and associated Point_Array and Conic_Weight.
Provides options to treat open Contours as closed, and to ignore
degenerate data.
#Example
#Height 128
#Description
@ -5733,9 +5733,6 @@ with close(), forceClose is true : isClosedContour returns true
#Class RawIter
#Line # raw data iterator ##
Iterates through Verb_Array, and associated Point_Array and Conic_Weight.
Verb_Array, Point_Array, and Conic_Weight are returned unaltered.
#Code
class RawIter {
public:
@ -5748,6 +5745,9 @@ Verb_Array, Point_Array, and Conic_Weight are returned unaltered.
}
##
Iterates through Verb_Array, and associated Point_Array and Conic_Weight.
Verb_Array, Point_Array, and Conic_Weight are returned unaltered.
#Method RawIter()
#Line # constructs empty Path iterator ##

View File

@ -1,5 +1,5 @@
#Topic Pixmap
#Alias Pixmap_Reference
#Alias Pixmap_Reference ##
#Class SkPixmap

View File

@ -1,6 +1,6 @@
#Topic Point
#Alias Points
#Alias Point_Reference
#Alias Points ##
#Alias Point_Reference ##
#Struct SkPoint
@ -1261,8 +1261,8 @@ Returns the dot product of Vector and Vector vec.
#Subtopic Vector
#Line # alias for Point ##
#Alias Vector
#Alias Vectors
#Alias Vector ##
#Alias Vectors ##
#Typedef SkPoint SkVector
#Line # alias for Point ##
#Code

View File

@ -1,6 +1,6 @@
#Topic Rect
#Alias Rects
#Alias Rect_Reference
#Alias Rects ##
#Alias Rect_Reference ##
#Struct SkRect

View File

@ -1,5 +1,5 @@
#Topic Surface
#Alias Surface_Reference
#Alias Surface_Reference ##
#Class SkSurface

View File

@ -2,7 +2,6 @@
#External
DirectWrite TrueType Windows Linux Android iOS __ANDROID_API__ AHardwareBuffer
FreeType FreeType-based Harfbuzz
Descenders Kerning Unhinted
LCD RGB sRGB ARGB BGR YUV SDTV HDTV
YUV_Component_Y YUV_Component_U YUV_Component_V
Unicode Unicode5 UTF-8 UTF-16 UTF-32 ASCII Unichar
@ -14,7 +13,7 @@
RFC
NaN NaNs
Bezier_Curve Coons_Patch Cartesian_Coordinate Euclidean_Distance Euclidean_Space Mip_Map
C C++ Destructor Subclasses
C C++
CSS HTML
HTML_Gray HTML_DarkGray HTML_LightGray HTML_Silver HTML_Lime HTML_Green HTML_Aqua HTML_Fuchsia
SVG_lightgray SVG_darkgray
@ -49,17 +48,49 @@ FT_Load_Glyph
#External ##
# this jargon requires a substitute to lower-case the word. The word is uppercase because
# it is not a dictionary word. An alternative would be to put this in an exception list
# in the spell checker
#Topic Destructor
#Substitute destructor
##
# see comment for Destructor above
#Topic Subclasses
#Substitute subclasses
##
# see comment for Destructor above
#Topic Descenders
#Substitute descenders
##
# see comment for Destructor above
#Topic Grayscale
#Substitute grayscale
##
# see comment for Destructor above
#Topic Kerning
#Substitute kerning
##
# see comment for Destructor above
#Topic Unhinted
#Substitute unhinted
##
#Topic Alias
#Alias Aliased
#Alias Aliasing
#Alias Aliased ##
#Alias Aliasing ##
##
#Topic Arc
#Alias Arcs
#Alias Arcs ##
#Topic ##
#Topic Backend_Semaphore
#Alias Backend_Semaphores
#Alias Backend_Semaphores ##
#Class GrBackendSemaphore
##
##
@ -81,7 +112,7 @@ FT_Load_Glyph
#Topic ##
#Topic Circle
#Alias Circles
#Alias Circles ##
#Topic ##
#Topic Clip_Op
@ -132,7 +163,7 @@ FT_Load_Glyph
##
#Topic Curve
#Alias Curves
#Alias Curves ##
##
#Topic Data
@ -261,7 +292,7 @@ FT_Load_Glyph
#Topic ##
#Topic Glyph
#Alias Glyphs
#Alias Glyphs ##
##
#Topic GPU_Context
@ -309,7 +340,7 @@ FT_Load_Glyph
##
#Topic Line
#Alias Lines
#Alias Lines ##
#Topic ##
# to be in Topic Malloc_Pixel_Ref
@ -372,7 +403,7 @@ FT_Load_Glyph
#Typedef uint16_t SkGlyphID
#Typedef ##
#Topic Scalar
#Alias Scalar
#Alias Scalar ##
#Typedef float SkScalar
#Typedef ##
##
@ -420,7 +451,7 @@ FT_Load_Glyph
##
#Topic Oval
#Alias Ovals
#Alias Ovals ##
#Topic ##
#Topic Paint_Defaults
@ -435,7 +466,7 @@ FT_Load_Glyph
#Topic ##
#Topic Patch
#Alias Patches
#Alias Patches ##
#Topic ##
#Topic Path_Effect
@ -495,10 +526,6 @@ FT_Load_Glyph
#Enum SkPixelGeometry
##
# Topic Point_Array
# Substitute SkPoint arrays
# Topic ##
#Topic Point3
#Struct SkPoint3
##
@ -512,7 +539,7 @@ FT_Load_Glyph
##
#Topic Premultiply
#Alias Premultiplied
#Alias Premultiplied ##
##
#Topic Raster_Engine
@ -597,7 +624,7 @@ FT_Load_Glyph
##
#Topic Sprite
#Alias Sprites
#Alias Sprites ##
#Topic ##
#Topic Stream
@ -693,7 +720,7 @@ FT_Load_Glyph
# end of defined in types
#Topic Unpremultiply
#Alias Unpremultiplied
#Alias Unpremultiplied ##
##
#Topic Vertices

View File

@ -96,7 +96,7 @@ utility to restore <a href='SkCanvas_Reference#Canvas'>Canvas</a> state on destr
<a href='#SkAutoCanvasRestore_destructor'>~SkAutoCanvasRestore</a>()
</pre>
Restores <a href='SkCanvas_Reference#Canvas'>Canvas</a> to saved state. Destructor is called when container goes out of
Restores <a href='SkCanvas_Reference#Canvas'>Canvas</a> to saved state. <a href='undocumented#Destructor'>Destructor</a> is called when container goes out of
scope.
### See Also

View File

@ -11,7 +11,7 @@ describing the pixel format, and <a href='undocumented#Color_Space'>Color Space<
<a href='SkImageInfo_Reference#Image_Info'>Image Info</a> bounds may be located anywhere fully inside <a href='undocumented#Pixel_Ref'>Pixel Ref</a> bounds.
<a href='#Bitmap'>Bitmap</a> can be drawn using <a href='SkCanvas_Reference#Canvas'>Canvas</a>. <a href='#Bitmap'>Bitmap</a> can be a drawing destination for <a href='SkCanvas_Reference#Canvas'>Canvas</a>
draw member functionss. <a href='#Bitmap'>Bitmap</a> flexibility as a pixel container limits some
draw member functions. <a href='#Bitmap'>Bitmap</a> flexibility as a pixel container limits some
optimizations available to the target platform.
If pixel array is primarily read-only, use <a href='SkImage_Reference#Image'>Image</a> for better performance.

View File

@ -19,7 +19,7 @@ Request <a href='#Canvas'>Canvas</a> from <a href='SkSurface_Reference#Surface'>
<a href='#Canvas'>Canvas</a> generated by <a href='undocumented#GPU_Surface'>GPU Surface</a> uses Vulkan or OpenGL to draw to the GPU.
To draw to a document, obtain <a href='#Canvas'>Canvas</a> from <a href='undocumented#Canvas'>SVG Canvas</a>, <a href='undocumented#PDF'>Document PDF</a>, or <a href='undocumented#Recorder'>Picture Recorder</a>.
<a href='undocumented#Document'>Document</a> based <a href='#Canvas'>Canvas</a> and other <a href='#Canvas'>Canvas</a> Subclasses reference <a href='undocumented#Device'>Device</a> describing the
<a href='undocumented#Document'>Document</a> based <a href='#Canvas'>Canvas</a> and other <a href='#Canvas'>Canvas</a> <a href='undocumented#Subclasses'>Subclasses</a> reference <a href='undocumented#Device'>Device</a> describing the
destination.
<a href='#Canvas'>Canvas</a> can be constructed to draw to <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> without first creating <a href='undocumented#Raster_Surface'>Raster Surface</a>.
@ -758,7 +758,7 @@ paint draws text top to bottom
</pre>
Creates <a href='#Canvas'>Canvas</a> of the specified dimensions without a <a href='SkSurface_Reference#Surface'>Surface</a>.
Used by Subclasses with custom implementations for draw member functions.
Used by <a href='undocumented#Subclasses'>Subclasses</a> with custom implementations for draw member functions.
If <a href='#SkCanvas_int_int_const_SkSurfaceProps_star_props'>props</a> equals nullptr, <a href='undocumented#Surface_Properties'>Surface Properties</a> are created with
<a href='undocumented#Legacy_Font_Host'>Surface Properties Legacy Font Host</a> settings, which choose the pixel striping
@ -993,7 +993,7 @@ Frees up resources used by <a href='#Canvas'>Canvas</a>.
<div><fiddle-embed name="b7bc91ff16c9b9351b2a127f35394b82"><div><a href='#Canvas'>Canvas</a> <a href='#Layer'>Layer</a> draws into bitmap. <a href='#SkCanvas_saveLayerAlpha'>saveLayerAlpha</a> sets up an additional
drawing surface that blends with the bitmap. When <a href='#Layer'>Layer</a> goes out of
scope, <a href='#Layer'>Layer</a> Destructor is called. The saved <a href='#Layer'>Layer</a> is restored, drawing
scope, <a href='#Layer'>Layer</a> <a href='undocumented#Destructor'>Destructor</a> is called. The saved <a href='#Layer'>Layer</a> is restored, drawing
transparent letters.
</div></fiddle-embed></div>
@ -2332,7 +2332,6 @@ scalePaint blends <a href='#Layer'>Layer</a> back with transparency.
## <a name='Layer_SaveLayerRec'>Layer SaveLayerRec</a>
# <a name='SkCanvas_SaveLayerRec'>Struct SkCanvas::SaveLayerRec</a>
<a href='#SkCanvas_SaveLayerRec_SaveLayerRec'>SaveLayerRec</a> contains the state used to create the <a href='#Layer'>Layer</a>.
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
struct <a href='#SkCanvas_SaveLayerRec_SaveLayerRec'>SaveLayerRec</a> {
@ -2345,6 +2344,8 @@ scalePaint blends <a href='#Layer'>Layer</a> back with transparency.
};
</pre>
<a href='#SkCanvas_SaveLayerRec_SaveLayerRec'>SaveLayerRec</a> contains the state used to create the <a href='#Layer'>Layer</a>.
## <a name='Layer_SaveLayerRec_Overview'>Layer SaveLayerRec Overview</a>
<table style='border-collapse: collapse; width: 62.5em'>
@ -3114,7 +3115,7 @@ The clip restriction is not recorded in pictures.
Pass an empty <a href='#SkCanvas_androidFramework_setDeviceClipRestriction_rect'>rect</a> to disable maximum clip.
This is private API to be used only by Android framework.
This private API is for use by Android framework only.
### Parameters
@ -5108,7 +5109,7 @@ If <a href='SkPaint_Reference#Paint'>Paint</a> <a href='#SkCanvas_drawImageNine_
If <a href='#SkCanvas_drawImageNine_paint'>paint</a> contains <a href='undocumented#Mask_Filter'>Mask Filter</a>, generate mask from image bounds. If <a href='#SkCanvas_drawImageNine_paint'>paint</a>
<a href='undocumented#Filter_Quality'>Filter Quality</a> set to <a href='undocumented#kNone_SkFilterQuality'>kNone_SkFilterQuality</a>, disable pixel filtering. For all
other values of <a href='#SkCanvas_drawImageNine_paint'>paint</a> <a href='undocumented#Filter_Quality'>Filter Quality</a>, use <a href='undocumented#kLow_SkFilterQuality'>kLow_SkFilterQuality</a> to filter pixels.
Any <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> on the <a href='#SkCanvas_drawImageNine_paint'>paint</a> is ignored as is the <a href='#SkCanvas_drawImageNine_paint'>paint</a>'s antialiasing state.
Any <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> on <a href='#SkCanvas_drawImageNine_paint'>paint</a> is ignored as is <a href='#SkCanvas_drawImageNine_paint'>paint</a> <a href='SkPaint_Reference#Anti_Alias'>Anti Aliasing</a> state.
If generated mask extends beyond <a href='#SkCanvas_drawImageNine_image'>image</a> bounds, replicate <a href='#SkCanvas_drawImageNine_image'>image</a> edge colors, just
as <a href='undocumented#Shader'>Shader</a> made from <a href='SkImage_Reference#SkImage_makeShader'>SkImage::makeShader</a> with <a href='undocumented#SkShader_kClamp_TileMode'>SkShader::kClamp TileMode</a> set
replicates the <a href='#SkCanvas_drawImageNine_image'>image</a> edge color when it samples outside of its bounds.
@ -5157,11 +5158,12 @@ the <a href='#SkCanvas_drawImageNine_2_center'>center</a>. Corners are not scale
are larger than <a href='#SkCanvas_drawImageNine_2_dst'>dst</a>; <a href='#SkCanvas_drawImageNine_2_center'>center</a> and four sides are scaled to fit remaining space, if any.
Additionally transform draw using <a href='#Clip'>Clip</a>, <a href='#Matrix'>Matrix</a>, and optional <a href='SkPaint_Reference#Paint'>Paint</a> <a href='#SkCanvas_drawImageNine_2_paint'>paint</a>.
If <a href='SkPaint_Reference#Paint'>Paint</a> <a href='#SkCanvas_drawImageNine_2_paint'>paint</a> is supplied, apply <a href='undocumented#Color_Filter'>Color Filter</a>, <a href='SkColor_Reference#Alpha'>Color Alpha</a>, <a href='undocumented#Image_Filter'>Image Filter</a>,
<a href='undocumented#Blend_Mode'>Blend Mode</a>, and <a href='undocumented#Draw_Looper'>Draw Looper</a>. If <a href='#SkCanvas_drawImageNine_2_image'>image</a> is <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>, apply <a href='undocumented#Shader'>Shader</a>.
If <a href='#SkCanvas_drawImageNine_2_paint'>paint</a> contains <a href='undocumented#Mask_Filter'>Mask Filter</a>, generate mask from <a href='#SkCanvas_drawImageNine_2_image'>image</a> bounds.
<a href='undocumented#Blend_Mode'>Blend Mode</a>, and <a href='undocumented#Draw_Looper'>Draw Looper</a>. If image is <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a>, apply <a href='undocumented#Shader'>Shader</a>.
If <a href='#SkCanvas_drawImageNine_2_paint'>paint</a> contains <a href='undocumented#Mask_Filter'>Mask Filter</a>, generate mask from image bounds. If <a href='#SkCanvas_drawImageNine_2_paint'>paint</a>
<a href='undocumented#Filter_Quality'>Filter Quality</a> set to <a href='undocumented#kNone_SkFilterQuality'>kNone_SkFilterQuality</a>, disable pixel filtering. For all
other values of <a href='#SkCanvas_drawImageNine_2_paint'>paint</a> <a href='undocumented#Filter_Quality'>Filter Quality</a>, use <a href='undocumented#kLow_SkFilterQuality'>kLow_SkFilterQuality</a> to filter pixels.
Any <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> on <a href='#SkCanvas_drawImageNine_2_paint'>paint</a> is ignored as is <a href='#SkCanvas_drawImageNine_2_paint'>paint</a> <a href='SkPaint_Reference#Anti_Alias'>Anti Aliasing</a> state.
If generated mask extends beyond <a href='#SkCanvas_drawImageNine_2_image'>image</a> bounds, replicate <a href='#SkCanvas_drawImageNine_2_image'>image</a> edge colors, just
as <a href='undocumented#Shader'>Shader</a> made from <a href='SkImage_Reference#SkImage_makeShader'>SkImage::makeShader</a> with <a href='undocumented#SkShader_kClamp_TileMode'>SkShader::kClamp TileMode</a> set
replicates the <a href='#SkCanvas_drawImageNine_2_image'>image</a> edge color when it samples outside of its bounds.
@ -5424,7 +5426,7 @@ If <a href='SkPaint_Reference#Paint'>Paint</a> <a href='#SkCanvas_drawBitmapNine
If <a href='#SkCanvas_drawBitmapNine_paint'>paint</a> contains <a href='undocumented#Mask_Filter'>Mask Filter</a>, generate mask from bitmap bounds. If <a href='#SkCanvas_drawBitmapNine_paint'>paint</a>
<a href='undocumented#Filter_Quality'>Filter Quality</a> set to <a href='undocumented#kNone_SkFilterQuality'>kNone_SkFilterQuality</a>, disable pixel filtering. For all
other values of <a href='#SkCanvas_drawBitmapNine_paint'>paint</a> <a href='undocumented#Filter_Quality'>Filter Quality</a>, use <a href='undocumented#kLow_SkFilterQuality'>kLow_SkFilterQuality</a> to filter pixels.
Any <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> on the <a href='#SkCanvas_drawBitmapNine_paint'>paint</a> is ignored as is the <a href='#SkCanvas_drawBitmapNine_paint'>paint</a>'s antialiasing state.
Any <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> on <a href='#SkCanvas_drawBitmapNine_paint'>paint</a> is ignored as is <a href='#SkCanvas_drawBitmapNine_paint'>paint</a> <a href='SkPaint_Reference#Anti_Alias'>Anti Aliasing</a> state.
If generated mask extends beyond <a href='#SkCanvas_drawBitmapNine_bitmap'>bitmap</a> bounds, replicate <a href='#SkCanvas_drawBitmapNine_bitmap'>bitmap</a> edge colors,
just as <a href='undocumented#Shader'>Shader</a> made from <a href='undocumented#SkShader_MakeBitmapShader'>SkShader::MakeBitmapShader</a> with
<a href='undocumented#SkShader_kClamp_TileMode'>SkShader::kClamp TileMode</a> set replicates the <a href='#SkCanvas_drawBitmapNine_bitmap'>bitmap</a> edge color when it samples
@ -5466,13 +5468,6 @@ and below <a href='#SkCanvas_drawBitmapNine_center'>center</a> to fill the remai
## <a name='Draw_Image_Lattice'>Draw Image Lattice</a>
# <a name='SkCanvas_Lattice'>Struct SkCanvas::Lattice</a>
<a href='#SkCanvas_Lattice'>Lattice</a> divides <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> or <a href='SkImage_Reference#Image'>Image</a> into a rectangular grid.
Grid entries on even columns and even rows are fixed; these entries are
always drawn at their original size if the destination is large enough.
If the destination side is too small to hold the fixed entries, all fixed
entries are proportionately scaled down to fit.
The grid entries not on even columns and rows are scaled to fit the
remaining space, if any.
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
struct <a href='#SkCanvas_Lattice'>Lattice</a> {
@ -5488,6 +5483,14 @@ remaining space, if any.
};
</pre>
<a href='#SkCanvas_Lattice'>Lattice</a> divides <a href='SkBitmap_Reference#Bitmap'>Bitmap</a> or <a href='SkImage_Reference#Image'>Image</a> into a rectangular grid.
Grid entries on even columns and even rows are fixed; these entries are
always drawn at their original size if the destination is large enough.
If the destination side is too small to hold the fixed entries, all fixed
entries are proportionately scaled down to fit.
The grid entries not on even columns and rows are scaled to fit the
remaining space, if any.
## <a name='Draw_Image_Lattice_Overview'>Draw Image Lattice Overview</a>
<table style='border-collapse: collapse; width: 62.5em'>
@ -5663,7 +5666,7 @@ If <a href='SkPaint_Reference#Paint'>Paint</a> <a href='#SkCanvas_drawBitmapLatt
If <a href='#SkCanvas_drawBitmapLattice_paint'>paint</a> contains <a href='undocumented#Mask_Filter'>Mask Filter</a>, generate mask from bitmap bounds. If <a href='#SkCanvas_drawBitmapLattice_paint'>paint</a>
<a href='undocumented#Filter_Quality'>Filter Quality</a> set to <a href='undocumented#kNone_SkFilterQuality'>kNone_SkFilterQuality</a>, disable pixel filtering. For all
other values of <a href='#SkCanvas_drawBitmapLattice_paint'>paint</a> <a href='undocumented#Filter_Quality'>Filter Quality</a>, use <a href='undocumented#kLow_SkFilterQuality'>kLow_SkFilterQuality</a> to filter pixels.
Any <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> on the <a href='#SkCanvas_drawBitmapLattice_paint'>paint</a> is ignored as is the <a href='#SkCanvas_drawBitmapLattice_paint'>paint</a>'s antialiasing state.
Any <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> on <a href='#SkCanvas_drawBitmapLattice_paint'>paint</a> is ignored as is <a href='#SkCanvas_drawBitmapLattice_paint'>paint</a> <a href='SkPaint_Reference#Anti_Alias'>Anti Aliasing</a> state.
If generated mask extends beyond <a href='#SkCanvas_drawBitmapLattice_bitmap'>bitmap</a> bounds, replicate <a href='#SkCanvas_drawBitmapLattice_bitmap'>bitmap</a> edge colors,
just as <a href='undocumented#Shader'>Shader</a> made from <a href='undocumented#SkShader_MakeBitmapShader'>SkShader::MakeBitmapShader</a> with
<a href='undocumented#SkShader_kClamp_TileMode'>SkShader::kClamp TileMode</a> set replicates the <a href='#SkCanvas_drawBitmapLattice_bitmap'>bitmap</a> edge color when it samples
@ -5724,7 +5727,7 @@ If <a href='SkPaint_Reference#Paint'>Paint</a> <a href='#SkCanvas_drawImageLatti
If <a href='#SkCanvas_drawImageLattice_paint'>paint</a> contains <a href='undocumented#Mask_Filter'>Mask Filter</a>, generate mask from image bounds. If <a href='#SkCanvas_drawImageLattice_paint'>paint</a>
<a href='undocumented#Filter_Quality'>Filter Quality</a> set to <a href='undocumented#kNone_SkFilterQuality'>kNone_SkFilterQuality</a>, disable pixel filtering. For all
other values of <a href='#SkCanvas_drawImageLattice_paint'>paint</a> <a href='undocumented#Filter_Quality'>Filter Quality</a>, use <a href='undocumented#kLow_SkFilterQuality'>kLow_SkFilterQuality</a> to filter pixels.
Any <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> on the <a href='#SkCanvas_drawImageLattice_paint'>paint</a> is ignored as is the <a href='#SkCanvas_drawImageLattice_paint'>paint</a>'s antialiasing state.
Any <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> on <a href='#SkCanvas_drawImageLattice_paint'>paint</a> is ignored as is <a href='#SkCanvas_drawImageLattice_paint'>paint</a> <a href='SkPaint_Reference#Anti_Alias'>Anti Aliasing</a> state.
If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
just as <a href='undocumented#Shader'>Shader</a> made from <a href='undocumented#SkShader_MakeBitmapShader'>SkShader::MakeBitmapShader</a> with
<a href='undocumented#SkShader_kClamp_TileMode'>SkShader::kClamp TileMode</a> set replicates the bitmap edge color when it samples
@ -5978,7 +5981,7 @@ void <a href='#SkCanvas_drawPosText'>drawPosText</a>(const void* text, size_t by
described by <a href='#SkCanvas_drawPosText_byteLength'>byteLength</a> of <a href='#SkCanvas_drawPosText_text'>text</a>.
<a href='#SkCanvas_drawPosText_text'>text</a> meaning depends on <a href='SkPaint_Reference#Text_Encoding'>Paint Text Encoding</a>; by default, <a href='#SkCanvas_drawPosText_text'>text</a> is encoded as
UTF-8. <a href='#SkCanvas_drawPosText_pos'>pos</a> elements' meaning depends on <a href='SkPaint_Reference#Text_Align'>Paint Text Align</a> and <a href='SkPaint_Reference#Vertical_Text'>Paint Vertical Text</a>;
UTF-8. <a href='#SkCanvas_drawPosText_pos'>pos</a> elements meaning depends on <a href='SkPaint_Reference#Vertical_Text'>Paint Vertical Text</a>;
by default each glyph left side bearing is positioned at x and its
baseline is positioned at y. <a href='undocumented#Text'>Text</a> size is affected by <a href='#Matrix'>Matrix</a> and
<a href='SkPaint_Reference#Text_Size'>Paint Text Size</a>.
@ -6029,7 +6032,7 @@ void <a href='#SkCanvas_drawPosTextH'>drawPosTextH</a>(const void* text, size_t
must match the number of <a href='undocumented#Glyph'>Glyphs</a> described by <a href='#SkCanvas_drawPosTextH_byteLength'>byteLength</a> of <a href='#SkCanvas_drawPosTextH_text'>text</a>.
<a href='#SkCanvas_drawPosTextH_text'>text</a> meaning depends on <a href='SkPaint_Reference#Text_Encoding'>Paint Text Encoding</a>; by default, <a href='#SkCanvas_drawPosTextH_text'>text</a> is encoded as
UTF-8. <a href='#SkCanvas_drawPosTextH_xpos'>xpos</a> elements' meaning depends on <a href='SkPaint_Reference#Text_Align'>Paint Text Align</a> and <a href='SkPaint_Reference#Vertical_Text'>Paint Vertical Text</a>;
UTF-8. <a href='#SkCanvas_drawPosTextH_xpos'>xpos</a> elements meaning depends on <a href='SkPaint_Reference#Vertical_Text'>Paint Vertical Text</a>;
by default each glyph left side bearing is positioned at an <a href='#SkCanvas_drawPosTextH_xpos'>xpos</a> element and
its baseline is positioned at <a href='#SkCanvas_drawPosTextH_constY'>constY</a>. <a href='undocumented#Text'>Text</a> size is affected by <a href='#Matrix'>Matrix</a> and
<a href='SkPaint_Reference#Text_Size'>Paint Text Size</a>.
@ -6139,21 +6142,22 @@ void <a href='#SkCanvas_drawTextOnPath'>drawTextOnPath</a>(const void* text, siz
<a href='#Draw'>Draw</a> <a href='#SkCanvas_drawTextOnPath_text'>text</a> on <a href='SkPath_Reference#Path'>Path</a> <a href='#SkCanvas_drawTextOnPath_path'>path</a>, using <a href='#Clip'>Clip</a>, <a href='#Matrix'>Matrix</a>, and <a href='SkPaint_Reference#Paint'>Paint</a> <a href='#SkCanvas_drawTextOnPath_paint'>paint</a>.
Origin of <a href='#SkCanvas_drawTextOnPath_text'>text</a> is at beginning of <a href='#SkCanvas_drawTextOnPath_path'>path</a> offset by <a href='#SkCanvas_drawTextOnPath_matrix'>matrix</a>, if not nullptr.
<a href='#SkCanvas_drawTextOnPath_matrix'>matrix</a> also transforms <a href='#SkCanvas_drawTextOnPath_text'>text</a> before <a href='#SkCanvas_drawTextOnPath_text'>text</a> is mapped to <a href='#SkCanvas_drawTextOnPath_path'>path</a>. If the <a href='#SkCanvas_drawTextOnPath_path'>path</a> section
<a href='#SkCanvas_drawTextOnPath_matrix'>matrix</a> transforms <a href='#SkCanvas_drawTextOnPath_text'>text</a> before <a href='#SkCanvas_drawTextOnPath_text'>text</a> is mapped to <a href='#SkCanvas_drawTextOnPath_path'>path</a>. If the <a href='#SkCanvas_drawTextOnPath_path'>path</a> section
corresponding the glyph advance is curved, the glyph is drawn curved to match;
control points in the glyph are mapped to projected points parallel to the <a href='#SkCanvas_drawTextOnPath_path'>path</a>.
If the <a href='#SkCanvas_drawTextOnPath_text'>text</a> advance is larger than the <a href='#SkCanvas_drawTextOnPath_path'>path</a> length, the excess <a href='#SkCanvas_drawTextOnPath_text'>text</a> is clipped.
<a href='#SkCanvas_drawTextOnPath_matrix'>matrix</a> does not effect <a href='#SkCanvas_drawTextOnPath_paint'>paint</a> <a href='undocumented#Shader'>Shader</a>.
<a href='#SkCanvas_drawTextOnPath_text'>text</a> meaning depends on <a href='SkPaint_Reference#Text_Encoding'>Paint Text Encoding</a>; by default, <a href='#SkCanvas_drawTextOnPath_text'>text</a> is encoded as
UTF-8. Origin meaning depends on <a href='SkPaint_Reference#Text_Align'>Paint Text Align</a> and <a href='SkPaint_Reference#Vertical_Text'>Paint Vertical Text</a>; by
default <a href='#SkCanvas_drawTextOnPath_text'>text</a> positions the first glyph left side bearing at origin x and its
baseline at origin y. <a href='undocumented#Text'>Text</a> size is affected by <a href='#SkCanvas_drawTextOnPath_matrix'>matrix</a> parameter, <a href='#Matrix'>Canvas Matrix</a>,
baseline at origin y. <a href='undocumented#Text'>Text</a> size is affected by <a href='#SkCanvas_drawTextOnPath_matrix'>matrix</a> parameter, <a href='#Canvas'>Canvas</a> <a href='#Matrix'>Matrix</a>,
and <a href='SkPaint_Reference#Text_Size'>Paint Text Size</a>.
All elements of <a href='#SkCanvas_drawTextOnPath_paint'>paint</a>: <a href='undocumented#Path_Effect'>Path Effect</a>, <a href='undocumented#Mask_Filter'>Mask Filter</a>, <a href='undocumented#Shader'>Shader</a>,
<a href='undocumented#Color_Filter'>Color Filter</a>, <a href='undocumented#Image_Filter'>Image Filter</a>, and <a href='undocumented#Draw_Looper'>Draw Looper</a>; apply to <a href='#SkCanvas_drawTextOnPath_text'>text</a>. By default, draws
filled 12 point black <a href='undocumented#Glyph'>Glyphs</a>. <a href='#Canvas'>Canvas</a> <a href='#Matrix'>Matrix</a> does effect <a href='#SkCanvas_drawTextOnPath_paint'>paint</a> <a href='undocumented#Shader'>Shader</a>, but
<a href='#SkCanvas_drawTextOnPath_matrix'>matrix</a> parameter does not.
filled 12 point black <a href='undocumented#Glyph'>Glyphs</a>.
### Parameters
@ -6196,8 +6200,8 @@ void <a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a>(const void* text, s
<a href='#Draw'>Draw</a> <a href='#SkCanvas_drawTextRSXform_text'>text</a>, transforming each glyph by the corresponding <a href='undocumented#SkRSXform'>SkRSXform</a>,
using <a href='#Clip'>Clip</a>, <a href='#Matrix'>Matrix</a>, and <a href='SkPaint_Reference#Paint'>Paint</a> <a href='#SkCanvas_drawTextRSXform_paint'>paint</a>.
<a href='undocumented#RSXform'>RSXform</a> array specifies a separate square scale, rotation, and translation for
each glyph.
<a href='undocumented#RSXform'>RSXform</a> <a href='#SkCanvas_drawTextRSXform_xform'>xform</a> array specifies a separate square scale, rotation, and translation
for each glyph. <a href='#SkCanvas_drawTextRSXform_xform'>xform</a> does not affect <a href='#SkCanvas_drawTextRSXform_paint'>paint</a> <a href='undocumented#Shader'>Shader</a>.
Optional <a href='SkRect_Reference#Rect'>Rect</a> <a href='#SkCanvas_drawTextRSXform_cullRect'>cullRect</a> is a conservative bounds of <a href='#SkCanvas_drawTextRSXform_text'>text</a>, taking into account
<a href='undocumented#RSXform'>RSXform</a> and <a href='#SkCanvas_drawTextRSXform_paint'>paint</a>. If <a href='#SkCanvas_drawTextRSXform_cullRect'>cullRect</a> is outside of <a href='#Clip'>Clip</a>, canvas can skip drawing.

View File

@ -724,4 +724,4 @@ Can also be used to add <a href='#IVector'>IVector</a> to <a href='#IVector'>IVe
</pre>
<a href='#SkIVector'>SkIVector</a> provides an alternative name for <a href='#SkIPoint'>SkIPoint</a>. <a href='#SkIVector'>SkIVector</a> and <a href='#SkIPoint'>SkIPoint</a>
can be used interchangably for all purposes.
can be used interchangeably for all purposes.

View File

@ -69,7 +69,7 @@ SkImageInfo related constants are defined by <code>enum</code>, <code>enum class
</tr>
<tr style='background-color: #f0f0f0; '>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#kGray_8_SkColorType'>kGray_8_SkColorType</a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>pixel with grayscale level in 8-bit byte</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>pixel with <a href='undocumented#Grayscale'>Grayscale</a> level in 8-bit byte</td>
</tr>
<tr>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#kJPEG_SkYUVColorSpace'>kJPEG_SkYUVColorSpace</a></td>
@ -346,7 +346,7 @@ true if <a href='#SkAlphaTypeIsOpaque_at'>at</a> equals <a href='#kOpaque_SkAlph
</pre>
Describes how pixel bits encode color. A pixel may be an alpha mask, a
grayscale, RGB, or ARGB.
<a href='undocumented#Grayscale'>Grayscale</a>, RGB, or ARGB.
<a href='#kN32_SkColorType'>kN32_SkColorType</a> selects the native 32-bit ARGB format. On Little_Endian
processors, pixels containing 8-bit ARGB components pack into 32-bit
@ -684,7 +684,7 @@ draw all colors possible to a <a href='#kRGB_101010x_SkColorType'>kRGB_101010x_S
## <a name='Color_Type_Gray_8'>Color Type Gray 8</a>
<a href='#kGray_8_SkColorType'>kGray_8_SkColorType</a> encodes grayscale level in eight bits that is equivalent
<a href='#kGray_8_SkColorType'>kGray_8_SkColorType</a> encodes <a href='undocumented#Grayscale'>Grayscale</a> level in eight bits that is equivalent
to equal values for red, blue, and green, representing colors from black to
white. Pixels described by <a href='#kGray_8_SkColorType'>kGray_8_SkColorType</a> are fully
opaque as if its <a href='SkColor_Reference#Alpha'>Color Alpha</a> was set to one, and should always be paired with
@ -1146,7 +1146,7 @@ SkImageInfo global, <code>struct</code>, and <code>class</code> related member f
</tr>
<tr style='background-color: #f0f0f0; '>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Color_Type_Gray_8'>Color Type Gray 8</a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>encodes level of grayscale in 8 bits</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>encodes level of <a href='undocumented#Grayscale'>Grayscale</a> in 8 bits</td>
</tr>
<tr>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Color_Type_RGBA_1010102'>Color Type RGBA 1010102</a></td>

View File

@ -349,7 +349,7 @@ SkPaint related constants are defined by <code>enum</code>, <code>enum class</co
</tr>
<tr>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#SkPaint_kFull_Hinting'>kFull Hinting</a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>modifies glyph outlines for maxiumum constrast</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>modifies glyph outlines for maximum constrast</td>
</tr>
<tr style='background-color: #f0f0f0; '>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#SkPaint_kGlyphID_TextEncoding'>kGlyphID TextEncoding</a></td>
@ -1357,7 +1357,7 @@ gray-level rendering.
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kFull_Hinting'><code>SkPaint::kFull_Hinting</code></a></td>
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
Modifies glyph outlines for maxiumum constrast. With FreeType, this selects
Modifies glyph outlines for maximum constrast. With FreeType, this selects
FT_LOAD_TARGET_LCD or FT_LOAD_TARGET_LCD_V if <a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText Flag</a> is set.
FT_LOAD_TARGET_LCD is a variant of FT_LOAD_TARGET_NORMAL optimized for
horizontally decimated LCD displays; FT_LOAD_TARGET_LCD_V is a
@ -1367,9 +1367,9 @@ variant of FT_LOAD_TARGET_NORMAL optimized for vertically decimated LCD displays
</table>
On <a href='undocumented#OS_X'>OS X</a> and iOS, hinting controls whether <a href='undocumented#Core_Graphics'>Core Graphics</a> dilates the font outlines
to account for LCD text. No hinting uses <a href='undocumented#Core_Text'>Core Text</a> gray scale output.
to account for LCD text. No hinting uses <a href='undocumented#Core_Text'>Core Text</a> <a href='undocumented#Grayscale'>Grayscale</a> output.
Normal hinting uses <a href='undocumented#Core_Text'>Core Text</a> LCD output. If <a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText Flag</a> is clear,
the LCD output is reduced to a single grayscale channel.
the LCD output is reduced to a single <a href='undocumented#Grayscale'>Grayscale</a> channel.
On Windows with DirectWrite, <a href='#SkPaint_Hinting'>Hinting</a> has no effect.
@ -2249,7 +2249,7 @@ is positioned to the right of the preceding glyph. <a href='#Vertical_Text'>Vert
Skia can translate text character codes as a series of <a href='undocumented#Glyph'>Glyphs</a>, but does not implement
font substitution,
textual substitution, line layout, or contextual spacing like Kerning pairs. Use
textual substitution, line layout, or contextual spacing like <a href='undocumented#Kerning'>Kerning</a> pairs. Use
a text shaping engine like <a href='https://harfbuzz.org/'>HarfBuzz</a></a> to translate text runs
into glyph series.
@ -2416,12 +2416,12 @@ paint1 == paint2
## <a name='Full_Hinting_Spacing'>Full Hinting Spacing</a>
if <a href='#SkPaint_Hinting'>Hinting</a> is set to <a href='#SkPaint_kFull_Hinting'>kFull Hinting</a>, <a href='#Full_Hinting_Spacing'>Full Hinting Spacing</a> adjusts the character
spacing by the difference of the hinted and Unhinted <a href='undocumented#Left_Side_Bearing'>Left Side Bearing</a> and
spacing by the difference of the hinted and <a href='undocumented#Unhinted'>Unhinted</a> <a href='undocumented#Left_Side_Bearing'>Left Side Bearing</a> and
<a href='undocumented#Right_Side_Bearing'>Right Side Bearing</a>. <a href='#Full_Hinting_Spacing'>Full Hinting Spacing</a> only applies to platforms that use
FreeType as their <a href='undocumented#Engine'>Font Engine</a>.
<a href='#Full_Hinting_Spacing'>Full Hinting Spacing</a> is not related to text Kerning, where the space between
a specific pair of characters is adjusted using data in the font Kerning tables.
<a href='#Full_Hinting_Spacing'>Full Hinting Spacing</a> is not related to text <a href='undocumented#Kerning'>Kerning</a>, where the space between
a specific pair of characters is adjusted using data in the font <a href='undocumented#Kerning'>Kerning</a> tables.
<a name='SkPaint_isDevKernText'></a>
## isDevKernText
@ -4393,7 +4393,8 @@ and by its height if <a href='#SkPaint_Flags'>Flags</a> has <a href='#SkPaint_kV
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kAlignCount'><code>SkPaint::kAlignCount</code></a></td>
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
number of different Text_Align values defined</td>
May be used to verify that <a href='#SkPaint_Align'>Align</a> is a legal value.
</td>
</tr>
</table>
@ -5788,7 +5789,7 @@ Uses <a href='#SkPaint_getPosTextPath_pos'>pos</a> array and <a href='#Text_Alig
<a href='#Text_Intercepts'>Text Intercepts</a> describe the intersection of drawn text <a href='undocumented#Glyph'>Glyphs</a> with a pair
of lines parallel to the text advance. <a href='#Text_Intercepts'>Text Intercepts</a> permits creating a
underline that skips Descenders.
underline that skips <a href='undocumented#Descenders'>Descenders</a>.
<a name='SkPaint_getTextIntercepts'></a>
## getTextIntercepts
@ -6071,7 +6072,7 @@ For example:
if (!path.isInverseFillType() && paint.<a href='#SkPaint_canComputeFastBounds'>canComputeFastBounds</a>) {
<a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkPaint_computeFastBounds_storage'>storage</a>;
if (canvas->quickReject(paint.computeFastBounds(path.getBounds(), &<a href='#SkPaint_computeFastBounds_storage'>storage</a>))) {
return; // don't draw the path
return; // do not draw the path
}
}
// draw the path

View File

@ -998,7 +998,7 @@ Releases ownership of any shared data and deletes data if <a href='#Path'>Path</
### Example
<div><fiddle-embed name="01ad6be9b7d15a2217daea273eb3d466"><div>delete calls <a href='#Path'>Path</a> Destructor, but copy of original in path2 is unaffected.
<div><fiddle-embed name="01ad6be9b7d15a2217daea273eb3d466"><div>delete calls <a href='#Path'>Path</a> <a href='undocumented#Destructor'>Destructor</a>, but copy of original in path2 is unaffected.
</div></fiddle-embed></div>
### See Also
@ -3228,7 +3228,7 @@ have no effect; <a href='#Conic'>Conic</a> is identical to a line segment from s
point. If <a href='#Conic_Weight'>Weight</a> is less than one, <a href='#Conic'>Conic</a> follows an elliptical arc.
If <a href='#Conic_Weight'>Weight</a> is exactly one, then <a href='#Conic'>Conic</a> is identical to <a href='#Quad'>Quad</a>; <a href='#Conic'>Conic</a> follows a
parabolic arc. If <a href='#Conic_Weight'>Weight</a> is greater than one, <a href='#Conic'>Conic</a> follows a hyperbolic
arc. If <a href='#Conic_Weight'>Weight</a> is infinity, <a href='#Conic'>Conic</a> is indentical to two line segments, connecting
arc. If <a href='#Conic_Weight'>Weight</a> is infinity, <a href='#Conic'>Conic</a> is identical to two line segments, connecting
start <a href='SkPoint_Reference#Point'>Point</a> to control <a href='SkPoint_Reference#Point'>Point</a>, and control <a href='SkPoint_Reference#Point'>Point</a> to end <a href='SkPoint_Reference#Point'>Point</a>.
### Example
@ -5334,7 +5334,7 @@ Returns zero if <a href='#Path'>Path</a> contains no <a href='undocumented#Line'
### Example
<div><fiddle-embed name="af0c66aea3ef81b709664c7007f48aae">
<div><fiddle-embed name="657a3f3e11acafea92b84d6bb0c13633">
#### Example Output
@ -5746,9 +5746,7 @@ SkPath member functions read and modify the structure properties.
<tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Topic</th>
<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr>
</table>
Iterates through <a href='#Verb_Array'>Verb Array</a>, and associated <a href='#Point_Array'>Point Array</a> and <a href='#Conic_Weight'>Conic Weight</a>.
Provides options to treat open <a href='#Contour'>Contours</a> as closed, and to ignore
degenerate data.
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
class <a href='#SkPath_Iter_Iter'>Iter</a> {
@ -5763,6 +5761,10 @@ public:
};
</pre>
Iterates through <a href='#Verb_Array'>Verb Array</a>, and associated <a href='#Point_Array'>Point Array</a> and <a href='#Conic_Weight'>Conic Weight</a>.
Provides options to treat open <a href='#Contour'>Contours</a> as closed, and to ignore
degenerate data.
### Example
<div><fiddle-embed name="2f53df9201769ab7e7c0e164a1334309"><div>Ignoring the actual <a href='#Verb'>Verbs</a> and replacing them with <a href='#Quad'>Quads</a> rounds the
@ -6120,8 +6122,7 @@ SkPath member functions read and modify the structure properties.
<tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Topic</th>
<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr>
</table>
Iterates through <a href='#Verb_Array'>Verb Array</a>, and associated <a href='#Point_Array'>Point Array</a> and <a href='#Conic_Weight'>Conic Weight</a>.
<a href='#Verb_Array'>Verb Array</a>, <a href='#Point_Array'>Point Array</a>, and <a href='#Conic_Weight'>Conic Weight</a> are returned unaltered.
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
class <a href='#SkPath_RawIter_RawIter'>RawIter</a> {
@ -6135,6 +6136,9 @@ Iterates through <a href='#Verb_Array'>Verb Array</a>, and associated <a href='#
}
</pre>
Iterates through <a href='#Verb_Array'>Verb Array</a>, and associated <a href='#Point_Array'>Point Array</a> and <a href='#Conic_Weight'>Conic Weight</a>.
<a href='#Verb_Array'>Verb Array</a>, <a href='#Point_Array'>Point Array</a>, and <a href='#Conic_Weight'>Conic Weight</a> are returned unaltered.
<a name='SkPath_RawIter_RawIter'></a>
## RawIter

View File

@ -180,6 +180,10 @@ SK_API void <a href='#SkDebugf'>SkDebugf</a>(const char format[], ...)
# <a name='SkDeferredDisplayListRecorder'>Class SkDeferredDisplayListRecorder</a>
# <a name='Descenders'>Descenders</a>
# <a name='Destructor'>Destructor</a>
# <a name='Device'>Device</a>
# <a name='SkBaseDevice'>Class SkBaseDevice</a>
@ -293,6 +297,8 @@ void <a href='#GrContext_flush'>flush</a>()
# <a name='Glyph'>Glyph</a>
# <a name='Grayscale'>Grayscale</a>
# <a name='HTML_Canvas'>HTML Canvas</a>
## <a name='ArcTo'>ArcTo</a>
@ -316,6 +322,8 @@ void <a href='#SkImageFilter_toString'>toString</a>(<a href='#SkString'>SkString
# <a name='Image_Scaling'>Image Scaling</a>
# <a name='Kerning'>Kerning</a>
# <a name='Left_Side_Bearing'>Left Side Bearing</a>
# <a name='Line'>Line</a>
@ -637,6 +645,8 @@ static <a href='#sk_sp'>sk sp</a>&lt;<a href='#SkShader'>SkShader</a>&gt; <a hre
# <a name='SkString'>Class SkString</a>
# <a name='Subclasses'>Subclasses</a>
# <a name='Supersampling'>Supersampling</a>
# <a name='Surface_Characterization'>Surface Characterization</a>
@ -693,6 +703,8 @@ bool <a href='#GrBackendTexture_isValid'>isValid</a>() const
# <a name='SkTypeface'>Class SkTypeface</a>
# <a name='Unhinted'>Unhinted</a>
# <a name='Unpremultiply'>Unpremultiply</a>
# <a name='Vertices'>Vertices</a>

View File

@ -176,7 +176,7 @@ BmhParser::MarkProps BmhParser::kMarkProps[] = {
, { "Set", MarkType::kSet, R_N, E_N, M(Example) | M(NoExample) }
, { "StdOut", MarkType::kStdOut, R_N, E_N, M(Example) | M(NoExample) }
, { "Struct", MarkType::kStruct, R_Y, E_O, M(Class) | M_ST }
, { "Substitute", MarkType::kSubstitute, R_N, E_N, M_ST }
, { "Substitute", MarkType::kSubstitute, R_N, E_N, M(Alias) | M_ST }
, { "Subtopic", MarkType::kSubtopic, R_Y, E_Y, M_CSST }
, { "Table", MarkType::kTable, R_Y, E_N, M(Method) | M_CSST | M_E }
, { "Template", MarkType::kTemplate, R_Y, E_N, M_CSST }
@ -426,6 +426,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
case MarkType::kDescription:
case MarkType::kStdOut:
// may be one-liner
case MarkType::kAlias:
case MarkType::kNoExample:
case MarkType::kParam:
case MarkType::kPhraseDef:
@ -474,6 +475,19 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
}
fParent->fChildren.push_back(definition);
}
if (MarkType::kAlias == markType) {
const char* end = definition->fChildren.size() > 0 ?
definition->fChildren[0]->fStart : definition->fContentEnd;
TextParser parser(definition->fFileName, definition->fContentStart, end,
definition->fLineCount);
parser.trimEnd();
string key = string(parser.fStart, parser.lineLength());
if (fAliasMap.end() != fAliasMap.find(key)) {
return this->reportError<bool>("duplicate alias");
}
fAliasMap[key] = definition;
definition->fFiddle = definition->fParent->fFiddle;
}
break;
} else if (MarkType::kPhraseDef == markType) {
bool hasParams = '(' == this->next();
@ -563,7 +577,6 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
}
break;
// always treated as one-liners (can't detect misuse easily)
case MarkType::kAlias:
case MarkType::kAnchor:
case MarkType::kBug:
case MarkType::kDeprecated:
@ -614,18 +627,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
definition->fContentEnd = link->fContentEnd;
definition->fTerminator = fChar;
definition->fChildren.emplace_back(link);
} else if (MarkType::kAlias == markType) {
this->skipWhiteSpace();
const char* start = fChar;
this->skipToNonName();
string alias(start, fChar - start);
if (fAliasMap.end() != fAliasMap.find(alias)) {
return this->reportError<bool>("duplicate alias");
}
fAliasMap[alias] = definition;
definition->fFiddle = definition->fParent->fFiddle;
}
else if (MarkType::kLine == markType) {
} else if (MarkType::kLine == markType) {
const char* nextLF = this->strnchr('\n', this->fEnd);
const char* start = fChar;
const char* end = this->trimmedBracketEnd(fMC);
@ -663,7 +665,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
fParent->fDetails =
this->skipExact("soon") ? Definition::Details::kSoonToBe_Deprecated :
this->skipExact("testing") ? Definition::Details::kTestingOnly_Experiment :
this->skipExact("do not use") ? Definition::Details::kDoNotUse_Experiement :
this->skipExact("do not use") ? Definition::Details::kDoNotUse_Experiment :
this->skipExact("not ready") ? Definition::Details::kNotReady_Experiment :
Definition::Details::kNone;
this->skipSpace();
@ -1317,7 +1319,9 @@ bool BmhParser::findDefinitions() {
return this->reportError<bool>("duplicate name");
}
if (hasEnd && expectEnd) {
SkASSERT(fMC != this->peek());
if (fMC == this->peek()) {
return this->reportError<bool>("missing body");
}
}
if (!this->addDefinition(defStart, hasEnd, markType, typeNameBuilder,
HasTag::kYes)) {
@ -1847,6 +1851,10 @@ const Definition* BmhParser::parentSpace() const {
return parent;
}
// A full terminal statement is in the form:
// \n optional-white-space #MarkType white-space #[# white-space]
// \n optional-white-space #MarkType white-space Name white-space #[# white-space]
// MarkType must match definition->fMarkType
const char* BmhParser::checkForFullTerminal(const char* end, const Definition* definition) const {
const char* start = end;
while ('\n' != start[0] && start > fStart) {
@ -1864,25 +1872,27 @@ const char* BmhParser::checkForFullTerminal(const char* end, const Definition* d
return end;
}
parser.skipWhiteSpace();
const char* nameStart = parser.fChar;
if (isupper(nameStart[0])) {
parser.skipToWhiteSpace();
if (parser.eof()) {
return end;
}
string defName = string(nameStart, parser.fChar - nameStart);
size_t defNamePos = definition->fName.rfind(defName);
if (definition->fName.length() != defNamePos + defName.length()) {
return end;
TextParser startName(fFileName, definition->fStart, definition->fContentStart,
definition->fLineCount);
if ('#' == startName.next()) {
startName.skipToSpace();
if (!startName.eof() && startName.skipSpace()) {
const char* nameBegin = startName.fChar;
startName.skipToWhiteSpace();
string name(nameBegin, (int) (startName.fChar - nameBegin));
if (fMC != parser.peek() && !parser.skipExact(name.c_str())) {
return end;
}
parser.skipSpace();
}
}
parser.skipWhiteSpace();
if (fMC != parser.next()) {
if (parser.eof() || fMC != parser.next()) {
return end;
}
if (!parser.eof() && fMC != parser.next()) {
return end;
}
SkASSERT(parser.eof());
return start;
}

View File

@ -811,7 +811,7 @@ public:
kNone,
kSoonToBe_Deprecated,
kTestingOnly_Experiment,
kDoNotUse_Experiement,
kDoNotUse_Experiment,
kNotReady_Experiment,
};
@ -1107,6 +1107,11 @@ public:
kYes,
};
enum class OneLine {
kNo,
kYes,
};
ParserCommon() : TextParser()
, fParent(nullptr)
, fDebugOut(false)
@ -1209,7 +1214,7 @@ public:
SkAssertResult(writeBlockTrim(size, data));
}
void writeBlockIndent(int size, const char* data);
bool writeBlockIndent(int size, const char* data);
void writeBlockSeparator() {
this->writeString(
@ -1225,7 +1230,12 @@ public:
this->writeSpace();
}
void writeCommentTrailer() {
void writeCommentTrailer(OneLine oneLine) {
if (OneLine::kNo == oneLine) {
this->lf(1);
} else {
this->writeSpace();
}
this->writeString("*/");
this->lfcr();
}
@ -2012,6 +2022,11 @@ public:
};
struct Item {
void reset() {
fName = "";
fValue = "";
}
string fName;
string fValue;
};
@ -2047,9 +2062,9 @@ public:
bool checkChildCommentLength(const Definition* parent, MarkType childType) const;
void checkEnumLengths(const Definition& child, string enumName, ItemLength* length) const;
void constOut(const Definition* memberStart, const Definition& child,
const Definition* bmhConst);
void descriptionOut(const Definition* def, SkipFirstLine , Phrase );
void constOut(const Definition* memberStart, const Definition* bmhConst);
void constSizeMembers(const RootDefinition* root);
bool descriptionOut(const Definition* def, SkipFirstLine , Phrase );
void enumHeaderOut(RootDefinition* root, const Definition& child);
string enumMemberComment(const Definition* currentEnumItem, const Definition& child) const;
const Definition* enumMemberForComment(const Definition* currentEnumItem) const;
@ -2080,6 +2095,8 @@ public:
fBmhParser = nullptr;
fEnumDef = nullptr;
fMethodDef = nullptr;
fBmhConst = nullptr;
fConstDef = nullptr;
fBmhStructDef = nullptr;
fInStruct = false;
fWroteMethod = false;
@ -2087,6 +2104,7 @@ public:
fPendingMethod = false;
}
string resolveAlias(const Definition* );
string resolveMethod(const char* start, const char* end, bool first);
string resolveRef(const char* start, const char* end, bool first, RefType* refType);
Wrote rewriteBlock(int size, const char* data, Phrase phrase);
@ -2101,6 +2119,9 @@ private:
const Definition* fBmhMethod;
const Definition* fEnumDef;
const Definition* fMethodDef;
const Definition* fBmhConst;
const Definition* fConstDef;
const Definition* fLastDescription;
Definition* fBmhStructDef;
const char* fContinuation; // used to construct paren-qualified method name
int fAnonymousEnumCount;
@ -2109,6 +2130,10 @@ private:
int fStructMemberTab;
int fStructValueTab;
int fStructCommentTab;
int fStructMemberLength;
int fConstValueTab;
int fConstCommentTab;
int fConstLength;
bool fInStruct;
bool fWroteMethod;
bool fIndentNext;

View File

@ -814,21 +814,20 @@ bool Definition::hasMatch(string name) const {
}
string Definition::incompleteMessage(DetailsType detailsType) const {
if (!IncompleteAllowed(fMarkType)) {
auto iter = std::find_if(fChildren.begin(), fChildren.end(),
[](const Definition* test) { return IncompleteAllowed(test->fMarkType); });
SkASSERT(fChildren.end() != iter);
return (*iter)->incompleteMessage(detailsType);
}
string message = MarkType::kExperimental == fMarkType ?
SkASSERT(!IncompleteAllowed(fMarkType));
auto iter = std::find_if(fChildren.begin(), fChildren.end(),
[](const Definition* test) { return IncompleteAllowed(test->fMarkType); });
SkASSERT(fChildren.end() != iter);
SkASSERT(Details::kNone == (*iter)->fDetails);
string message = MarkType::kExperimental == (*iter)->fMarkType ?
"Experimental." : "Deprecated.";
if (Definition::Details::kDoNotUse_Experiement == fDetails) {
if (Details::kDoNotUse_Experiment == fDetails) {
message += " Do not use.";
} else if (Definition::Details::kNotReady_Experiment == fDetails) {
} else if (Details::kNotReady_Experiment == fDetails) {
message += " Not ready for general use.";
} else if (Definition::Details::kSoonToBe_Deprecated == fDetails) {
message += " Soon to be deprecated.";
} else if (Definition::Details::kTestingOnly_Experiment == fDetails) {
} else if (Details::kSoonToBe_Deprecated == fDetails) {
message = "To be deprecated soon.";
} else if (Details::kTestingOnly_Experiment == fDetails) {
message += " For testing only.";
}
if (DetailsType::kPhrase == detailsType) {

View File

@ -1276,7 +1276,7 @@ bool IncludeParser::findComments(const Definition& includeDef, Definition* marku
return true;
}
// caller calls reportError, so just return false here
// caller just returns, so report error here
bool IncludeParser::parseClass(Definition* includeDef, IsStruct isStruct) {
SkASSERT(includeDef->fTokens.size() > 0);
// parse class header
@ -1323,15 +1323,11 @@ bool IncludeParser::parseClass(Definition* includeDef, IsStruct isStruct) {
while (iter != includeDef->fTokens.end()
&& (publicLen != (size_t) (iter->fContentEnd - iter->fStart)
|| strncmp(iter->fStart, publicName, publicLen))) {
iter->fPrivate = true;
iter = std::next(iter);
++publicIndex;
}
}
auto childIter = includeDef->fChildren.begin();
while (childIter != includeDef->fChildren.end() && (*childIter)->fParentIndex < publicIndex) {
(*childIter)->fPrivate = true;
childIter = std::next(childIter);
}
int keyIndex = publicIndex;
KeyWord currentKey = KeyWord::kPublic;
const char* publicName = kKeyWords[(int) KeyWord::kPublic].fName;
@ -1340,9 +1336,12 @@ bool IncludeParser::parseClass(Definition* includeDef, IsStruct isStruct) {
size_t protectedLen = strlen(protectedName);
const char* privateName = kKeyWords[(int) KeyWord::kPrivate].fName;
size_t privateLen = strlen(privateName);
auto childIter = includeDef->fChildren.begin();
std::advance(childIter, publicIndex);
while (childIter != includeDef->fChildren.end()) {
Definition* child = *childIter;
while (child->fParentIndex > keyIndex && iter != includeDef->fTokens.end()) {
iter->fPrivate = KeyWord::kPublic != currentKey;
const char* testStart = iter->fStart;
size_t testLen = (size_t) (iter->fContentEnd - testStart);
iter = std::next(iter);
@ -1365,12 +1364,14 @@ bool IncludeParser::parseClass(Definition* includeDef, IsStruct isStruct) {
if (!this->parseObject(child, markupDef)) {
return false;
}
} else {
child->fPrivate = true;
}
fLastObject = child;
childIter = std::next(childIter);
}
while (iter != includeDef->fTokens.end()) {
iter->fPrivate = KeyWord::kPublic != currentKey;
iter = std::next(iter);
}
SkASSERT(fParent->fParent);
fParent = fParent->fParent;
return true;

View File

@ -58,22 +58,24 @@ void IncludeWriter::checkEnumLengths(const Definition& child, string enumName, I
}
}
void IncludeWriter::constOut(const Definition* memberStart, const Definition& child,
const Definition* bmhConst) {
void IncludeWriter::constOut(const Definition* memberStart, const Definition* bmhConst) {
const char* bodyEnd = fDeferComment ? fDeferComment->fContentStart - 1 :
memberStart->fContentStart;
this->writeBlockTrim((int) (bodyEnd - fStart), fStart); // may write nothing
this->lf(2);
this->writeCommentHeader();
fIndent += 4;
this->descriptionOut(bmhConst, SkipFirstLine::kYes, Phrase::kNo);
if (!this->descriptionOut(bmhConst, SkipFirstLine::kYes, Phrase::kNo)) {
return memberStart->reportError<void>("expected description for const");
}
fIndent -= 4;
this->writeCommentTrailer();
this->writeCommentTrailer(OneLine::kNo);
fStart = memberStart->fContentStart;
}
void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirstLine,
bool IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirstLine,
Phrase phrase) {
bool wroteSomething = false;
const char* commentStart = def->fContentStart;
if (SkipFirstLine::kYes == skipFirstLine) {
TextParser parser(def);
@ -87,8 +89,12 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
string message = def->incompleteMessage(Definition::DetailsType::kSentence);
this->writeString(message);
this->lfcr();
wroteSomething = true;
}
const Definition* lastDescription = def;
for (auto prop : def->fChildren) {
fLastDescription = lastDescription;
lastDescription = prop;
switch (prop->fMarkType) {
case MarkType::kCode: {
bool literal = false;
@ -98,6 +104,7 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
SkASSERT(commentLen < 1000);
if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
this->lf(2);
wroteSomething = true;
}
}
size_t childSize = prop->fChildren.size();
@ -116,14 +123,14 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
if (!literalOutdent) {
fIndent += 4;
}
this->writeBlockIndent(commentLen, commentStart);
wroteSomething |= this->writeBlockIndent(commentLen, commentStart);
this->lf(2);
if (!literalOutdent) {
fIndent -= 4;
}
commentStart = prop->fTerminator;
SkDEBUGCODE(wroteCode = true);
}
commentStart = prop->fTerminator;
} break;
case MarkType::kDefinedBy:
commentStart = prop->fTerminator;
@ -133,6 +140,7 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
prop->fContentEnd - prop->fContentStart) + ')');
this->writeString(bugstr);
this->lfcr();
wroteSomething = true;
}
case MarkType::kDeprecated:
case MarkType::kPrivate:
@ -141,10 +149,11 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
SkASSERT(commentLen < 1000);
if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
this->lfcr();
wroteSomething = true;
}
}
commentStart = prop->fContentStart;
if (' ' < commentStart[0]) {
if (MarkType::kPrivate != prop->fMarkType && ' ' < commentStart[0]) {
commentStart = strchr(commentStart, '\n');
}
if (MarkType::kBug == prop->fMarkType) {
@ -152,7 +161,7 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
}
commentLen = (int) (prop->fContentEnd - commentStart);
if (commentLen > 0) {
this->writeBlockIndent(commentLen, commentStart);
wroteSomething |= this->writeBlockIndent(commentLen, commentStart);
const char* end = commentStart + commentLen;
while (end > commentStart && ' ' == end[-1]) {
--end;
@ -165,8 +174,6 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
commentLen = (int) (def->fContentEnd - commentStart);
break;
case MarkType::kExperimental:
this->writeString("EXPERIMENTAL:");
this->writeSpace();
commentStart = prop->fContentStart;
if (' ' < commentStart[0]) {
commentStart = strchr(commentStart, '\n');
@ -175,6 +182,7 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
if (commentLen > 0) {
if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
this->lfcr();
wroteSomething = true;
}
}
commentStart = prop->fTerminator;
@ -190,13 +198,14 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
} else {
this->writeSpace();
}
wroteSomething = true;
}
}
int saveIndent = fIndent;
if (fIndent < fColumn + 1) {
fIndent = fColumn + 1;
}
this->writeBlockIndent(prop->length(), prop->fContentStart);
wroteSomething |= this->writeBlockIndent(prop->length(), prop->fContentStart);
fIndent = saveIndent;
commentStart = prop->fTerminator;
commentLen = (int) (def->fContentEnd - commentStart);
@ -217,6 +226,7 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
SkASSERT(commentLen < 1000);
if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart, Phrase::kNo)) {
this->lfcr();
wroteSomething = true;
}
}
commentStart = prop->fTerminator;
@ -228,6 +238,7 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
if (Wrote::kNone != this->rewriteBlock(commentLen, commentStart,
Phrase::kNo)) {
this->lfcr();
wroteSomething = true;
}
}
for (auto row : prop->fChildren) {
@ -236,7 +247,7 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
SkASSERT(MarkType::kColumn == column->fMarkType);
this->writeString("-");
this->writeSpace();
this->descriptionOut(column, SkipFirstLine::kNo, Phrase::kNo);
wroteSomething |= this->descriptionOut(column, SkipFirstLine::kNo, Phrase::kNo);
this->lf(1);
}
}
@ -252,10 +263,11 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
this->rewriteBlock(commentLen, commentStart, Phrase::kNo);
// ince we don't do line wrapping, always insert LF before phrase
this->lfcr(); // TODO: remove this once rewriteBlock rewraps paragraphs
wroteSomething = true;
}
auto iter = fBmhParser->fPhraseMap.find(prop->fName);
if (fBmhParser->fPhraseMap.end() == iter) {
return this->reportError<void>("missing phrase definition");
return this->reportError<bool>("missing phrase definition");
}
Definition* phraseDef = iter->second;
// TODO: given TextParser(commentStart, prop->fStart + up to #) return if
@ -289,12 +301,16 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
this->writeSpace();
}
defIsPhrase = Phrase::kYes;
wroteSomething = true;
}
if (length > 0) {
this->rewriteBlock(length, start, defIsPhrase);
}
commentStart = prop->fContentStart;
commentLen = (int) (def->fContentEnd - commentStart);
if ('\n' == commentStart[0] && '\n' == commentStart[1]) {
this->lf(2);
}
} break;
default:
commentLen = (int) (prop->fStart - commentStart);
@ -307,7 +323,9 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
SkASSERT(wroteCode || (commentLen > 0 && commentLen < 1500) || def->fDeprecated);
if (commentLen > 0) {
this->rewriteBlock(commentLen, commentStart, phrase);
wroteSomething = true;
}
return wroteSomething;
}
void IncludeWriter::enumHeaderOut(RootDefinition* root, const Definition& child) {
@ -435,7 +453,7 @@ void IncludeWriter::enumHeaderOut(RootDefinition* root, const Definition& child)
if (wroteHeader) {
fIndent -= 4;
this->lfcr();
this->writeCommentTrailer();
this->writeCommentTrailer(OneLine::kNo);
}
Definition* braceHolder = child.fChildren[0];
if (KeyWord::kClass == braceHolder->fKeyWord) {
@ -474,7 +492,7 @@ string IncludeWriter::enumMemberComment(const Definition* currentEnumItem,
break;
}
if (IncompleteAllowed(constItem->fMarkType)) {
shortComment = constItem->incompleteMessage(Definition::DetailsType::kPhrase);
shortComment = constItem->fParent->incompleteMessage(Definition::DetailsType::kPhrase);
}
}
if (!shortComment.length()) {
@ -617,6 +635,7 @@ void IncludeWriter::enumMembersOut(Definition& child) {
}
if (ItemState::kNone != state) {
this->enumMemberOut(currentEnumItem, child, item, preprocessor);
item.reset();
fStart = token.fContentStart;
state = ItemState::kNone;
last.fStart = nullptr;
@ -840,7 +859,7 @@ void IncludeWriter::methodOut(Definition* method, const Definition& child) {
}
fIndent -= 4;
this->lfcr();
this->writeCommentTrailer();
this->writeCommentTrailer(OneLine::kNo);
fBmhMethod = nullptr;
fMethodDef = nullptr;
fEnumDef = nullptr;
@ -864,7 +883,7 @@ void IncludeWriter::structOut(const Definition* root, const Definition& child,
}
fIndent -= 4;
this->lfcr();
this->writeCommentTrailer();
this->writeCommentTrailer(OneLine::kNo);
}
bool IncludeWriter::findEnumSubtopic(string undername, const Definition** rootDefPtr) const {
@ -916,36 +935,18 @@ Definition* IncludeWriter::structMemberOut(const Definition* memberStart, const
string name(child.fContentStart, (int) (child.fContentEnd - child.fContentStart));
Definition* commentBlock = this->findMemberCommentBlock(fBmhStructDef->fChildren, name);
if (!commentBlock) {
return memberStart->reportError<Definition*>("member missing comment block");
return memberStart->reportError<Definition*>("member missing comment block 2");
}
#if 0
if (!commentBlock->fShort) {
const char* commentStart = commentBlock->fContentStart;
ptrdiff_t commentLen = commentBlock->fContentEnd - commentStart;
auto lineIter = std::find_if(commentBlock->fChildren.begin(), commentBlock->fChildren.end(),
[](const Definition* def){ return MarkType::kLine == def->fMarkType; } );
SkASSERT(commentBlock->fChildren.end() != lineIter);
const Definition* lineDef = *lineIter;
if (fStructMemberLength > 100) {
this->writeCommentHeader();
bool wroteLineFeed = false;
fIndent += 4;
for (auto child : commentBlock->fChildren) {
commentLen = child->fStart - commentStart;
wroteLineFeed |= Wrote::kLF == this->rewriteBlock(commentLen, commentStart, Phrase::kNo);
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, Phrase::kNo);
fIndent -= 4;
if (wroteLineFeed || fColumn > 100 - 3 /* space * / */ ) {
this->lfcr();
} else {
this->writeSpace();
}
this->writeCommentTrailer();
this->writeSpace();
this->rewriteBlock(lineDef->length(), lineDef->fContentStart, Phrase::kYes);
this->writeCommentTrailer(OneLine::kYes);
}
#endif
this->lfcr();
this->writeBlock((int) (child.fStart - memberStart->fContentStart),
memberStart->fContentStart);
@ -967,22 +968,80 @@ Definition* IncludeWriter::structMemberOut(const Definition* memberStart, const
valueStart->fContentStart);
}
this->writeString(";");
/* if (commentBlock->fShort) */ {
if (fStructMemberLength <= 100) {
this->indentToColumn(fStructCommentTab);
this->writeString("//!<");
this->writeSpace();
string extract = fBmhParser->extractText(commentBlock, BmhParser::TrimExtract::kYes);
this->rewriteBlock(extract.length(), &extract.front(), Phrase::kNo);
this->rewriteBlock(lineDef->length(), lineDef->fContentStart, Phrase::kYes);
}
this->lf(2);
this->lf(1);
return valueEnd;
}
// const and constexpr and #define aren't contained in a braces like struct and enum.
// use a bmh subtopic to group like ones together, then measure them in the include as if
// they were formally linked together
void IncludeWriter::constSizeMembers(const RootDefinition* root) {
// fBmhConst->fParent is subtopic containing all grouped const expressions
// fConstDef is token of const include name, hopefully on same line as const start
string rootPrefix = root ? root->fName + "::" : "";
const Definition* test = fConstDef;
int tokenIndex = test->fParentIndex;
int longestName = 0;
int longestValue = 0;
int longestComment = 0;
const Definition* subtopic = fBmhConst->fParent;
SkASSERT(subtopic);
SkASSERT(MarkType::kSubtopic == subtopic->fMarkType);
// back up to first token on line
size_t lineCount = test->fLineCount;
const Definition* last;
auto tokenIter = test->fParent->fTokens.begin();
std::advance(tokenIter, tokenIndex);
do {
last = test;
std::advance(tokenIter, -1);
test = &*tokenIter;
SkASSERT(test->fParentIndex == --tokenIndex);
} while (lineCount == test->fLineCount);
test = last;
for (auto child : subtopic->fChildren) {
if (MarkType::kConst != child->fMarkType) {
continue;
}
// expect found name to be on the left of assign
// expect assign
// expect semicolon
// no parens, no braces
while (rootPrefix + test->fName != child->fName) {
std::advance(tokenIter, 1);
test = &*tokenIter;
SkASSERT(lineCount >= test->fLineCount);
}
++lineCount;
TextParser constText(test);
const char* nameEnd = constText.trimmedBracketEnd('=');
SkAssertResult(constText.skipToEndBracket('='));
const char* valueEnd = constText.trimmedBracketEnd(';');
auto lineIter = std::find_if(child->fChildren.begin(), child->fChildren.end(),
[](const Definition* def){ return MarkType::kLine == def->fMarkType; });
SkASSERT(child->fChildren.end() != lineIter);
longestName = SkTMax(longestName, (int) (nameEnd - constText.fStart));
longestValue = SkTMax(longestValue, (int) (valueEnd - constText.fChar));
longestComment = SkTMax(longestComment, (*lineIter)->length());
}
// write fStructValueTab, fStructCommentTab
fConstValueTab = longestName + fIndent + 1;
fConstCommentTab = fConstValueTab + longestValue + 2;
fConstLength = fConstCommentTab + longestComment + (int) sizeof("//!<");
}
void IncludeWriter::structSizeMembers(const Definition& child) {
int longestType = 0;
Definition* typeStart = nullptr;
int longestName = 0;
int longestValue = 0;
int longestComment = 0;
SkASSERT(child.fChildren.size() == 1 || child.fChildren.size() == 2);
bool inEnum = false;
bool inMethod = false;
@ -1066,6 +1125,18 @@ void IncludeWriter::structSizeMembers(const Definition& child) {
longestName = SkTMax(longestName, (int) (token.fContentEnd - token.fContentStart));
typeStart->fMemberStart = true;
inMember = true;
string tokenName(token.fContentStart, (int) (token.fContentEnd - token.fContentStart));
Definition* commentBlock = this->findMemberCommentBlock(fBmhStructDef->fChildren,
tokenName);
if (!commentBlock) {
return token.reportError<void>("member missing comment block 1");
}
auto lineIter = std::find_if(commentBlock->fChildren.begin(),
commentBlock->fChildren.end(),
[](const Definition* def){ return MarkType::kLine == def->fMarkType; } );
SkASSERT(commentBlock->fChildren.end() != lineIter);
const Definition* lineDef = *lineIter;
longestComment = SkTMax(longestComment, lineDef->length());
continue;
}
if (MarkType::kMethod == token.fMarkType) {
@ -1089,6 +1160,7 @@ void IncludeWriter::structSizeMembers(const Definition& child) {
fStructCommentTab += longestValue + 3 /* space = space */ ;
fStructValueTab -= 1 /* ; */ ;
}
fStructMemberLength = fStructCommentTab + longestComment;
// iterate through struct to ensure that members' comments fit on line
// struct or class may not have any members
(void) this->checkChildCommentLength(fBmhStructDef, MarkType::kMember);
@ -1218,6 +1290,7 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
params.skipToEndBracket('(');
if (params.startsWith(child.fContentStart, childLen)) {
this->methodOut(clonedMethod, child);
sawConst = false;
break;
}
++alternate;
@ -1263,6 +1336,7 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
return child.reportError<bool>("method not found");
}
this->methodOut(method, child);
sawConst = false;
continue;
}
if (Definition::Type::kPunctuation == child.fType &&
@ -1283,6 +1357,7 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
continue;
}
this->methodOut(method, child);
sawConst = false;
continue;
} else if (fBmhStructDef && fBmhStructDef->fDeprecated) {
fContinuation = nullptr;
@ -1343,6 +1418,7 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
continue;
}
this->methodOut(method, child);
sawConst = false;
if (fAttrDeprecated) {
startDef = fAttrDeprecated;
fStart = fAttrDeprecated->fContentStart;
@ -1387,6 +1463,8 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
name = child.fName;
} else if (1 == trial) {
name = root->fName + "::" + child.fName;
} else if (2 == trial) {
name = root->fName;
} else {
SkASSERT(parent);
name = parent->fName + "::" + child.fName;
@ -1451,11 +1529,12 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
continue;
}
#endif
Definition* priorBlock = fBmhStructDef;
Definition* codeBlock = nullptr;
Definition* nextBlock = nullptr;
for (auto test : fBmhStructDef->fChildren) {
if (MarkType::kCode == test->fMarkType) {
SkASSERT(!codeBlock); // FIXME: check enum for correct order earlier
SkASSERT(!codeBlock); // FIXME: check enum earlier
codeBlock = test;
continue;
}
@ -1463,13 +1542,34 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
nextBlock = test;
break;
}
priorBlock = test;
}
// FIXME: trigger error earlier if inner #Struct or #Class is missing #Code
// FIXME: trigger error earlier if inner #Struct or #Class is missing #Code
if (!fBmhStructDef->fDeprecated) {
SkASSERT(codeBlock);
SkASSERT(nextBlock); // FIXME: check enum for correct order earlier
const char* commentStart = codeBlock->fTerminator;
const char* commentEnd = nextBlock->fStart;
// FIXME: trigger error if #Code is present but comment is before it earlier
SkASSERT(priorBlock); // code always preceded by #Line (I think)
TextParser priorComment(priorBlock->fFileName,
priorBlock->fTerminator, codeBlock->fStart,
priorBlock->fLineCount);
priorComment.trimEnd();
if (!priorComment.eof()) {
return priorBlock->reportError<bool>(
"expect no comment before #Code");
}
TextParser nextComment(codeBlock->fFileName, commentStart,
commentEnd, codeBlock->fLineCount);
nextComment.trimEnd();
if (!priorComment.eof()) {
return priorBlock->reportError<bool>(
"expect comment after #Code");
}
if (!nextComment.eof()) {
}
fIndentNext = true;
this->structOut(root, *fBmhStructDef, commentStart, commentEnd);
}
@ -1632,10 +1732,33 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
}
}
if (bmhConst) {
this->constOut(memberStart, child, bmhConst);
this->constOut(memberStart, bmhConst);
fDeferComment = nullptr;
sawConst = false;
}
} else if (MarkType::kNone == child.fMarkType && sawConst && !fEnumDef) {
string match;
if (root) {
match = root->fName + "::";
match += string(child.fContentStart, child.fContentEnd - child.fContentStart);
auto bmhClassIter = fBmhParser->fClassMap.find(root->fName);
if (fBmhParser->fClassMap.end() != bmhClassIter) {
RootDefinition& bmhClass = bmhClassIter->second;
auto constIter = std::find_if(bmhClass.fLeaves.begin(), bmhClass.fLeaves.end(),
[match](std::pair<const string, Definition>& leaf){ return match == leaf.second.fName; } );
if (bmhClass.fLeaves.end() != constIter) {
const Definition& bmhConst = constIter->second;
if (MarkType::kConst == bmhConst.fMarkType
&& MarkType::kSubtopic == bmhConst.fParent->fMarkType) {
fBmhConst = &bmhConst;
fConstDef = &child;
}
}
}
} else {
SkDebugf(""); // FIXME: support global constexpr
}
}
if (child.fMemberStart) {
memberStart = &child;
@ -1649,8 +1772,59 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
}
if (Definition::Type::kPunctuation == child.fType) {
if (Punctuation::kSemicolon == child.fPunctuation) {
if (sawConst && fBmhConst) { // find bmh documentation. Parent must be subtopic.
const Definition* subtopic = fBmhConst->fParent;
SkASSERT(subtopic);
SkASSERT(MarkType::kSubtopic == subtopic->fMarkType);
auto firstConst = std::find_if(subtopic->fChildren.begin(),
subtopic->fChildren.end(),
[](const Definition* def){ return MarkType::kConst == def->fMarkType;});
SkASSERT(firstConst != subtopic->fChildren.end());
bool constIsFirst = *firstConst == fBmhConst;
if (constIsFirst) { // If first #Const child, output subtopic description.
this->constOut(memberStart, subtopic);
// find member / value / comment tabs
// look for a one-to-one correspondence between bmh and include
this->constSizeMembers(root);
}
const char* blockStart = fDeferComment ? fLastComment->fContentEnd : fStart;
const char* blockEnd = fDeferComment ? fDeferComment->fStart - 1 :
memberStart->fStart;
this->writeBlockTrim((int) (blockEnd - blockStart), blockStart);
// after const code, output #Line description as short comment
auto lineIter = std::find_if(fBmhConst->fChildren.begin(),
fBmhConst->fChildren.end(),
[](const Definition* def){ return MarkType::kLine == def->fMarkType; });
SkASSERT(fBmhConst->fChildren.end() != lineIter);
const Definition* lineDef = *lineIter;
if (fConstLength > 100) {
this->writeCommentHeader();
this->writeSpace();
this->rewriteBlock(lineDef->length(), lineDef->fContentStart, Phrase::kYes);
this->writeCommentTrailer(OneLine::kYes);
}
this->lfcr();
TextParser constText(memberStart);
const char* nameEnd = constText.trimmedBracketEnd('=');
SkAssertResult(constText.skipToEndBracket('='));
const char* valueEnd = constText.trimmedBracketEnd(';');
this->writeBlock((int) (nameEnd - memberStart->fContentStart),
memberStart->fContentStart);
this->indentToColumn(fConstValueTab);
this->writeBlock((int) (valueEnd - constText.fChar), constText.fChar);
this->writeString(";");
if (fConstLength <= 100) {
this->indentToColumn(fConstCommentTab);
this->writeString("//!<");
this->writeSpace();
this->rewriteBlock(lineDef->length(), lineDef->fContentStart, Phrase::kYes);
}
fStart = child.fContentStart + 1;
fDeferComment = nullptr;
fBmhConst = nullptr;
sawConst = false;
}
memberStart = nullptr;
sawConst = false;
staticOnly = false;
if (inStruct) {
fInStruct = false;
@ -1763,6 +1937,25 @@ string IncludeWriter::resolveMethod(const char* start, const char* end, bool fir
RootDefinition::AllowParens::kNo);
if (defRef && MarkType::kMethod == defRef->fMarkType) {
substitute = methodname + "()";
} else {
auto defineIter = fBmhParser->fDefineMap.find(methodname);
if (fBmhParser->fDefineMap.end() != defineIter) {
const RootDefinition& defineDef = defineIter->second;
auto codeIter = std::find_if(defineDef.fChildren.begin(),
defineDef.fChildren.end(),
[](Definition* child){ return MarkType::kCode == child->fMarkType; } );
if (defineDef.fChildren.end() != codeIter) {
const Definition* codeDef = *codeIter;
string codeContents(codeDef->fContentStart, codeDef->length());
size_t namePos = codeContents.find(methodname);
if (string::npos != namePos) {
size_t parenPos = namePos + methodname.length();
if (parenPos < codeContents.length() && '(' == codeContents[parenPos]) {
substitute = methodname + "()";
}
}
}
}
}
}
if (fMethodDef && methodname == fMethodDef->fName) {
@ -1783,6 +1976,18 @@ string IncludeWriter::resolveMethod(const char* start, const char* end, bool fir
return substitute;
}
string IncludeWriter::resolveAlias(const Definition* def) {
for (auto child : def->fChildren) {
if (MarkType::kSubstitute == child->fMarkType) {
return string(child->fContentStart, (int) (child->fContentEnd - child->fContentStart));
}
if (MarkType::kAlias == child->fMarkType && def->fName == child->fName) {
return this->resolveAlias(child);
}
}
return "";
}
string IncludeWriter::resolveRef(const char* start, const char* end, bool first,
RefType* refType) {
// look up Xxx_Xxx
@ -1820,6 +2025,9 @@ string IncludeWriter::resolveRef(const char* start, const char* end, bool first,
}
}
}
if (!rootDef && fEnumDef && "Sk" + prefixedName == fEnumDef->fFiddle) {
rootDef = fEnumDef;
}
if (!rootDef && !substitute.length()) {
auto aliasIter = fBmhParser->fAliasMap.find(undername);
if (fBmhParser->fAliasMap.end() != aliasIter) {
@ -1837,17 +2045,9 @@ string IncludeWriter::resolveRef(const char* start, const char* end, bool first,
}
if (rootDef) {
MarkType rootType = rootDef->fMarkType;
bool isTopic = MarkType::kSubtopic == rootType || MarkType::kTopic == rootType;
auto substituteParent = MarkType::kAlias == rootType ? rootDef->fParent :
isTopic ? rootDef : nullptr;
if (substituteParent) {
for (auto child : substituteParent->fChildren) {
if (MarkType::kSubstitute == child->fMarkType) {
substitute = string(child->fContentStart,
(int) (child->fContentEnd - child->fContentStart));
break;
}
}
if (MarkType::kSubtopic == rootType || MarkType::kTopic == rootType
|| MarkType::kAlias == rootType) {
substitute = this->resolveAlias(rootDef);
}
if (!substitute.length()) {
string match = rootDef->fName;
@ -1856,7 +2056,7 @@ string IncludeWriter::resolveRef(const char* start, const char* end, bool first,
match.erase(index, 1);
}
string skmatch = "Sk" + match;
auto parent = substituteParent ? substituteParent : rootDef;
auto parent = MarkType::kAlias == rootType ? rootDef->fParent : rootDef;
for (auto child : parent->fChildren) {
// there may be more than one
// prefer the one mostly closely matching in text
@ -1910,6 +2110,22 @@ string IncludeWriter::resolveRef(const char* start, const char* end, bool first,
substitute += ' ';
substitute += ConvertRef(rootDef->fName, false);
} else {
size_t underpos = undername.find('_');
if (string::npos != underpos) {
string parentName = undername.substr(0, underpos);
string skName = "Sk" + parentName;
if (skName == parent->fName) {
SkASSERT(start >= fLastDescription->fContentStart);
string lastDescription = string(fLastDescription->fContentStart,
(int) (start - fLastDescription->fContentStart));
size_t lineStart = lastDescription.rfind('\n');
SkASSERT(string::npos != lineStart);
fLine = fLastDescription->fContentStart + lineStart + 1;
fChar = start;
fEnd = end;
return this->reportError<string>("remove underline");
}
}
substitute += ConvertRef(undername, first);
}
}

View File

@ -102,7 +102,8 @@ bool ParserCommon::parseSetup(const char* path) {
return true;
}
void ParserCommon::writeBlockIndent(int size, const char* data) {
bool ParserCommon::writeBlockIndent(int size, const char* data) {
bool wroteSomething = false;
while (size && ' ' >= data[size - 1]) {
--size;
}
@ -113,7 +114,7 @@ void ParserCommon::writeBlockIndent(int size, const char* data) {
--size;
}
if (!size) {
return;
return wroteSomething;
}
if (newLine) {
this->lf(1);
@ -130,7 +131,9 @@ void ParserCommon::writeBlockIndent(int size, const char* data) {
size -= len;
data += len;
newLine = true;
wroteSomething = true;
}
return wroteSomething;
}
bool ParserCommon::writeBlockTrim(int size, const char* data) {