aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/SkCanvas_Reference.bmh9
-rw-r--r--docs/SkMatrix_Reference.bmh42
-rw-r--r--docs/SkPaint_Reference.bmh27
-rw-r--r--include/core/SkCanvas.h14
-rw-r--r--include/core/SkDrawFilter.h4
-rw-r--r--include/core/SkFont.h4
-rw-r--r--include/core/SkImageGenerator.h4
-rw-r--r--include/core/SkMatrix.h84
-rw-r--r--include/core/SkMatrix44.h6
-rw-r--r--include/core/SkPaint.h46
-rw-r--r--include/core/SkPixelRef.h2
-rw-r--r--include/core/SkRRect.h4
-rw-r--r--include/core/SkRegion.h18
-rw-r--r--include/core/SkShader.h4
-rw-r--r--include/core/SkStrokeRec.h5
-rw-r--r--include/core/SkYUVSizeInfo.h2
-rw-r--r--site/user/api/SkCanvas_Reference.md12
-rw-r--r--site/user/api/SkMatrix_Reference.md44
-rw-r--r--site/user/api/SkPaint_Reference.md34
-rw-r--r--site/user/api/catalog.htm32
-rw-r--r--tools/bookmaker/bookmaker.h6
-rw-r--r--tools/bookmaker/includeParser.cpp94
-rw-r--r--tools/bookmaker/includeWriter.cpp2
23 files changed, 262 insertions, 237 deletions
diff --git a/docs/SkCanvas_Reference.bmh b/docs/SkCanvas_Reference.bmh
index 0bce15e947..f4672c4dc5 100644
--- a/docs/SkCanvas_Reference.bmh
+++ b/docs/SkCanvas_Reference.bmh
@@ -1678,15 +1678,17 @@ add new markup to associate typedef SaveLayerFlags with Enum so that, for
documentation purposes, this enum is named rather than anonymous
##
-#Enum
+#Enum SaveLayerFlagsSet
#Line # sets SaveLayerRec options ##
#Code
- enum {
+ enum SaveLayerFlagsSet {
kPreserveLCDText_SaveLayerFlag = 1 << 1,
kInitWithPrevious_SaveLayerFlag = 1 << 2,
kMaskAgainstCoverage_EXPERIMENTAL_DONT_USE_SaveLayerFlag = 1 << 3,
kDontClipToLayer_Legacy_SaveLayerFlag = kDontClipToLayer_PrivateSaveLayerFlag,
};
+
+ typedef uint32_t SaveLayerFlags;
##
SaveLayerFlags provides options that may be used in any combination in SaveLayerRec,
@@ -1838,7 +1840,8 @@ Sets fBounds, fPaint, and fBackdrop to nullptr. Clears fSaveLayerFlags.
##
-#Method SaveLayerRec(const SkRect* bounds, const SkPaint* paint, SaveLayerFlags saveLayerFlags = 0)
+#Method SaveLayerRec(const SkRect* bounds, const SkPaint* paint,
+ SaveLayerFlags saveLayerFlags = 0)
Sets fBounds, fPaint, and fSaveLayerFlags; sets fBackdrop to nullptr.
diff --git a/docs/SkMatrix_Reference.bmh b/docs/SkMatrix_Reference.bmh
index 63040e8a21..ba3cf79a1d 100644
--- a/docs/SkMatrix_Reference.bmh
+++ b/docs/SkMatrix_Reference.bmh
@@ -619,20 +619,20 @@ for (SkScalar sx : { 1, 2 } ) {
# ------------------------------------------------------------------------------
-#Enum
+#Subtopic MemberIndex
+#In Constant
+#Line # member indices ##
#Code
- enum {
- kMScaleX,
- kMSkewX,
- kMTransX,
- kMSkewY,
- kMScaleY,
- kMTransY,
- kMPersp0,
- kMPersp1,
- kMPersp2,
- };
+ static constexpr int kMScaleX = 0;
+ static constexpr int kMSkewX = 1;
+ static constexpr int kMTransX = 2;
+ static constexpr int kMSkewY = 3;
+ static constexpr int kMScaleY = 4;
+ static constexpr int kMTransY = 5;
+ static constexpr int kMPersp0 = 6;
+ static constexpr int kMPersp1 = 7;
+ static constexpr int kMPersp2 = 8;
##
Matrix organizes its values in row order. These members correspond to
@@ -693,17 +693,17 @@ for (int i : { SkMatrix::kMScaleX, SkMatrix::kMSkewX, SkMatrix::kMTransX,
# ------------------------------------------------------------------------------
-#Enum
+#Subtopic AffineIndex
+#In Constant
+#Line # affine member indices ##
#Code
- enum {
- kAScaleX,
- kASkewY,
- kASkewX,
- kAScaleY,
- kATransX,
- kATransY,
- };
+ static constexpr int kAScaleX = 0;
+ static constexpr int kASkewY = 1;
+ static constexpr int kASkewX = 2;
+ static constexpr int kAScaleY = 3;
+ static constexpr int kATransX = 4;
+ static constexpr int kATransY = 5;
##
Affine arrays are in column major order to match the matrix used by
diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh
index 1467b5338c..47627361d4 100644
--- a/docs/SkPaint_Reference.bmh
+++ b/docs/SkPaint_Reference.bmh
@@ -1897,6 +1897,8 @@ while stroking.
kStroke_Style,
kStrokeAndFill_Style,
};
+
+ static constexpr int kStyleCount = kStrokeAndFill_Style + 1;
##
Set Style to fill, stroke, or both fill and stroke geometry.
@@ -1931,22 +1933,12 @@ a fill draw.
and the set Path_Fill_Type is ignored.
##
-#Enum Style ##
-
-#Enum
-#Line # number of Style defines ##
-#Code
- enum {
- kStyleCount = kStrokeAndFill_Style + 1,
- };
-##
-
#Const kStyleCount 3
The number of different Style values defined.
May be used to verify that Style is a legal value.
##
-#Enum ##
+#Enum Style ##
#Method Style getStyle() const
@@ -3493,6 +3485,8 @@ Increments drawLooper Reference_Count by one.
kCenter_Align,
kRight_Align,
};
+
+ static constexpr int kAlignCount = 3;
##
Align adjusts the text relative to the text position.
@@ -3526,17 +3520,6 @@ Align defaults to kLeft_Align.
and by its height if Flags has kVerticalText_Flag set.
##
-#Enum ##
-
-#Enum
-#Line # number of Text_Align values ##
-
-#Code
- enum {
- kAlignCount = 3,
- };
-##
-
#Const kAlignCount 3
The number of different Text_Align values defined.
##
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 73f7a3e8d9..f32fd0535c 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -596,11 +596,11 @@ public:
*/
int saveLayerAlpha(const SkRect* bounds, U8CPU alpha);
- /** \enum
+ /** \enum SaveLayerFlagsSet
SaveLayerFlags provides options that may be used in any combination in SaveLayerRec,
defining how layer allocated by saveLayer() operates.
*/
- enum {
+ enum SaveLayerFlagsSet {
/** Creates layer for LCD text. Flag is ignored if layer SkPaint contains
SkImageFilter or SkColorFilter.
*/
@@ -2639,12 +2639,12 @@ private:
SkDeque fMCStack;
// points to top of stack
MCRec* fMCRec;
+
// the first N recs that can fit here mean we won't call malloc
- enum {
- kMCRecSize = 128, // most recent measurement
- kMCRecCount = 32, // common depth for save/restores
- kDeviceCMSize = 224, // most recent measurement
- };
+ static constexpr int kMCRecSize = 128; // most recent measurement
+ static constexpr int kMCRecCount = 32; // common depth for save/restores
+ static constexpr int kDeviceCMSize = 224; // most recent measurement
+
intptr_t fMCRecStorage[kMCRecSize * kMCRecCount / sizeof(intptr_t)];
intptr_t fDeviceCMStorage[kDeviceCMSize / sizeof(intptr_t)];
diff --git a/include/core/SkDrawFilter.h b/include/core/SkDrawFilter.h
index 2812017b71..7150419108 100644
--- a/include/core/SkDrawFilter.h
+++ b/include/core/SkDrawFilter.h
@@ -37,9 +37,7 @@ public:
kText_Type,
};
- enum {
- kTypeCount = kText_Type + 1
- };
+ static constexpr int kTypeCount = kText_Type + 1;
/**
* Called with the paint that will be used to draw the specified type.
diff --git a/include/core/SkFont.h b/include/core/SkFont.h
index a58ec01926..48a3d99507 100644
--- a/include/core/SkFont.h
+++ b/include/core/SkFont.h
@@ -155,9 +155,7 @@ public:
static sk_sp<SkFont> Testing_CreateFromPaint(const SkPaint&);
private:
- enum {
- kAllFlags = 0xFF,
- };
+ static constexpr int kAllFlags = 0xFF;
SkFont(sk_sp<SkTypeface>, SkScalar size, SkScalar scaleX, SkScalar skewX, MaskType,
uint32_t flags);
diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h
index 0dae7d7489..2763ef9c33 100644
--- a/include/core/SkImageGenerator.h
+++ b/include/core/SkImageGenerator.h
@@ -170,9 +170,7 @@ public:
sk_sp<SkColorSpace>);
protected:
- enum {
- kNeedNewImageUniqueID = 0
- };
+ static constexpr int kNeedNewImageUniqueID = 0;
SkImageGenerator(const SkImageInfo& info, uint32_t uniqueId = kNeedNewImageUniqueID);
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h
index 333bcbf487..6a990526ab 100644
--- a/include/core/SkMatrix.h
+++ b/include/core/SkMatrix.h
@@ -263,34 +263,28 @@ public:
*/
bool preservesRightAngles(SkScalar tol = SK_ScalarNearlyZero) const;
- /** \enum
- SkMatrix organizes its values in row order. These members correspond to
+ /** SkMatrix organizes its values in row order. These members correspond to
each value in SkMatrix.
*/
- enum {
- kMScaleX, //!< horizontal scale factor
- kMSkewX, //!< horizontal skew factor
- kMTransX, //!< horizontal translation
- kMSkewY, //!< vertical skew factor
- kMScaleY, //!< vertical scale factor
- kMTransY, //!< vertical translation
- kMPersp0, //!< input x perspective factor
- kMPersp1, //!< input y perspective factor
- kMPersp2, //!< perspective bias
- };
-
- /** \enum
- Affine arrays are in column major order to match the matrix used by
+ static constexpr int kMScaleX = 0; //!< horizontal scale factor
+ static constexpr int kMSkewX = 1; //!< horizontal skew factor
+ static constexpr int kMTransX = 2; //!< horizontal translation
+ static constexpr int kMSkewY = 3; //!< vertical skew factor
+ static constexpr int kMScaleY = 4; //!< vertical scale factor
+ static constexpr int kMTransY = 5; //!< vertical translation
+ static constexpr int kMPersp0 = 6; //!< input x perspective factor
+ static constexpr int kMPersp1 = 7; //!< input y perspective factor
+ static constexpr int kMPersp2 = 8; //!< perspective bias
+
+ /** Affine arrays are in column major order to match the matrix used by
PDF and XPS.
*/
- enum {
- kAScaleX, //!< horizontal scale factor
- kASkewY, //!< vertical skew factor
- kASkewX, //!< horizontal skew factor
- kAScaleY, //!< vertical scale factor
- kATransX, //!< horizontal translation
- kATransY, //!< vertical translation
- };
+ static constexpr int kAScaleX = 0; //!< horizontal scale factor
+ static constexpr int kASkewY = 1; //!< vertical skew factor
+ static constexpr int kASkewX = 2; //!< horizontal skew factor
+ static constexpr int kAScaleY = 3; //!< vertical scale factor
+ static constexpr int kATransX = 4; //!< horizontal translation
+ static constexpr int kATransY = 5; //!< vertical translation
/** Returns one matrix value. Asserts if index is out of range and SK_DEBUG is
defined.
@@ -1722,33 +1716,31 @@ public:
bool isFinite() const { return SkScalarsAreFinite(fMat, 9); }
private:
- enum {
- /** Set if the matrix will map a rectangle to another rectangle. This
- can be true if the matrix is scale-only, or rotates a multiple of
- 90 degrees.
+ /** Set if the matrix will map a rectangle to another rectangle. This
+ can be true if the matrix is scale-only, or rotates a multiple of
+ 90 degrees.
- This bit will be set on identity matrices
- */
- kRectStaysRect_Mask = 0x10,
+ This bit will be set on identity matrices
+ */
+ static constexpr int kRectStaysRect_Mask = 0x10;
- /** Set if the perspective bit is valid even though the rest of
- the matrix is Unknown.
- */
- kOnlyPerspectiveValid_Mask = 0x40,
+ /** Set if the perspective bit is valid even though the rest of
+ the matrix is Unknown.
+ */
+ static constexpr int kOnlyPerspectiveValid_Mask = 0x40;
- kUnknown_Mask = 0x80,
+ static constexpr int kUnknown_Mask = 0x80;
- kORableMasks = kTranslate_Mask |
- kScale_Mask |
- kAffine_Mask |
- kPerspective_Mask,
+ static constexpr int kORableMasks = kTranslate_Mask |
+ kScale_Mask |
+ kAffine_Mask |
+ kPerspective_Mask;
- kAllMasks = kTranslate_Mask |
- kScale_Mask |
- kAffine_Mask |
- kPerspective_Mask |
- kRectStaysRect_Mask,
- };
+ static constexpr int kAllMasks = kTranslate_Mask |
+ kScale_Mask |
+ kAffine_Mask |
+ kPerspective_Mask |
+ kRectStaysRect_Mask;
SkScalar fMat[9];
mutable uint32_t fTypeMask;
diff --git a/include/core/SkMatrix44.h b/include/core/SkMatrix44.h
index 790cd9c7fa..f8b7b9547d 100644
--- a/include/core/SkMatrix44.h
+++ b/include/core/SkMatrix44.h
@@ -457,11 +457,9 @@ private:
SkMScalar fMat[4][4];
mutable unsigned fTypeMask;
- enum {
- kUnknown_Mask = 0x80,
+ static constexpr int kUnknown_Mask = 0x80;
- kAllPublic_Masks = 0xF
- };
+ static constexpr int kAllPublic_Masks = 0xF;
void as3x4RowMajorf(float[]) const;
void set3x4RowMajorf(const float[]);
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index a77d84d05f..7a65e2ca47 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -518,12 +518,10 @@ public:
kStrokeAndFill_Style,
};
- enum {
- /** The number of different Style values defined.
- May be used to verify that Style is a legal value.
- */
- kStyleCount = kStrokeAndFill_Style + 1,
- };
+ /** The number of different Style values defined.
+ May be used to verify that Style is a legal value.
+ */
+ static constexpr int kStyleCount = kStrokeAndFill_Style + 1;
/** Whether the geometry is filled, stroked, or filled and stroked.
@@ -949,9 +947,7 @@ public:
kRight_Align,
};
- enum {
- kAlignCount = 3, //!< The number of different Align values defined.
- };
+ static constexpr int kAlignCount = 3; //!< The number of different Align values defined.
/** Returns SkPaint::Align.
Returns kLeft_Align if SkPaint::Align has not been set.
@@ -1662,23 +1658,21 @@ private:
*/
SkColor computeLuminanceColor() const;
- enum {
- /* This is the size we use when we ask for a glyph's path. We then
- * post-transform it as we draw to match the request.
- * This is done to try to re-use cache entries for the path.
- *
- * This value is somewhat arbitrary. In theory, it could be 1, since
- * we store paths as floats. However, we get the path from the font
- * scaler, and it may represent its paths as fixed-point (or 26.6),
- * so we shouldn't ask for something too big (might overflow 16.16)
- * or too small (underflow 26.6).
- *
- * This value could track kMaxSizeForGlyphCache, assuming the above
- * constraints, but since we ask for unhinted paths, the two values
- * need not match per-se.
- */
- kCanonicalTextSizeForPaths = 64,
- };
+ /* This is the size we use when we ask for a glyph's path. We then
+ * post-transform it as we draw to match the request.
+ * This is done to try to re-use cache entries for the path.
+ *
+ * This value is somewhat arbitrary. In theory, it could be 1, since
+ * we store paths as floats. However, we get the path from the font
+ * scaler, and it may represent its paths as fixed-point (or 26.6),
+ * so we shouldn't ask for something too big (might overflow 16.16)
+ * or too small (underflow 26.6).
+ *
+ * This value could track kMaxSizeForGlyphCache, assuming the above
+ * constraints, but since we ask for unhinted paths, the two values
+ * need not match per-se.
+ */
+ static constexpr int kCanonicalTextSizeForPaths = 64;
static bool TooBigToUseCache(const SkMatrix& ctm, const SkMatrix& textM, SkScalar maxLimit);
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index c4bb709066..6c9ff0c363 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -121,7 +121,7 @@ private:
// Set true by caches when they cache content that's derived from the current pixels.
SkAtomic<bool> fAddedToCache;
- enum {
+ enum Mutability {
kMutable, // PixelRefs begin mutable.
kTemporarilyImmutable, // Considered immutable, but can revert to mutable.
kImmutable, // Once set to this state, it never leaves.
diff --git a/include/core/SkRRect.h b/include/core/SkRRect.h
index 5e67f1fccb..0acc7169ba 100644
--- a/include/core/SkRRect.h
+++ b/include/core/SkRRect.h
@@ -270,9 +270,7 @@ public:
bool isValid() const;
- enum {
- kSizeInMemory = 12 * sizeof(SkScalar)
- };
+ static constexpr size_t kSizeInMemory = 12 * sizeof(SkScalar);
/**
* Write the rrect into the specified buffer. This is guaranteed to always
diff --git a/include/core/SkRegion.h b/include/core/SkRegion.h
index a3aaee1cbe..42651da43c 100644
--- a/include/core/SkRegion.h
+++ b/include/core/SkRegion.h
@@ -30,9 +30,7 @@ namespace android {
class SK_API SkRegion {
public:
typedef int32_t RunType;
- enum {
- kRunTypeSentinel = 0x7FFFFFFF
- };
+ static constexpr int kRunTypeSentinel = 0x7FFFFFFF;
SkRegion();
SkRegion(const SkRegion&);
@@ -399,16 +397,12 @@ public:
SkDEBUGCODE(bool debugSetRuns(const RunType runs[], int count);)
private:
- enum {
- kOpCount = kReplace_Op + 1
- };
+ static constexpr int kOpCount = kReplace_Op + 1;
- enum {
- // T
- // [B N L R S]
- // S
- kRectRegionRuns = 7
- };
+ // T
+ // [B N L R S]
+ // S
+ static constexpr int kRectRegionRuns = 7;
friend class android::Region; // needed for marshalling efficiently
diff --git a/include/core/SkShader.h b/include/core/SkShader.h
index 58d9ca8da0..6c7b5cd5c6 100644
--- a/include/core/SkShader.h
+++ b/include/core/SkShader.h
@@ -62,9 +62,7 @@ public:
kLast_TileMode = kDecal_TileMode
};
- enum {
- kTileModeCount = kLast_TileMode + 1
- };
+ static constexpr int kTileModeCount = kLast_TileMode + 1;
/**
* Returns the local matrix.
diff --git a/include/core/SkStrokeRec.h b/include/core/SkStrokeRec.h
index 9a49a3da7d..ae059a9d51 100644
--- a/include/core/SkStrokeRec.h
+++ b/include/core/SkStrokeRec.h
@@ -29,9 +29,8 @@ public:
kStroke_Style,
kStrokeAndFill_Style
};
- enum {
- kStyleCount = kStrokeAndFill_Style + 1
- };
+
+ static constexpr int kStyleCount = kStrokeAndFill_Style + 1;
Style getStyle() const;
SkScalar getWidth() const { return fWidth; }
diff --git a/include/core/SkYUVSizeInfo.h b/include/core/SkYUVSizeInfo.h
index 19b5a8e89c..fc2ceba78c 100644
--- a/include/core/SkYUVSizeInfo.h
+++ b/include/core/SkYUVSizeInfo.h
@@ -11,7 +11,7 @@
#include "SkSize.h"
struct SkYUVSizeInfo {
- enum {
+ enum YUVIndex {
kY = 0,
kU = 1,
kV = 2,
diff --git a/site/user/api/SkCanvas_Reference.md b/site/user/api/SkCanvas_Reference.md
index a393168962..0ddcb7243b 100644
--- a/site/user/api/SkCanvas_Reference.md
+++ b/site/user/api/SkCanvas_Reference.md
@@ -59,8 +59,8 @@ This approach may be deprecated in the future.
| --- | --- |
| <a href="#SkCanvas_ColorBehavior">ColorBehavior</a> | Android framework only |
| <a href="#SkCanvas_PointMode">PointMode</a> | sets <a href="#SkCanvas_drawPoints">drawPoints</a> options |
+| <a href="#SkCanvas_SaveLayerFlagsSet">SaveLayerFlagsSet</a> | sets <a href="#SkCanvas_SaveLayerRec">SaveLayerRec</a> options |
| <a href="#SkCanvas_SrcRectConstraint">SrcRectConstraint</a> | sets <a href="#SkCanvas_drawImageRect">drawImageRect</a> options |
-| _anonymous | sets <a href="#SkCanvas_SaveLayerRec">SaveLayerRec</a> options |
## <a name="Class_or_Struct"></a> Class or Struct
@@ -1708,14 +1708,17 @@ depth of saved stack
---
-## <a name="SkCanvas__anonymous"></a> Enum SkCanvas::_anonymous
+## <a name="SkCanvas_SaveLayerFlagsSet"></a> Enum SkCanvas::SaveLayerFlagsSet
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
- enum {
+ enum <a href="#SkCanvas_SaveLayerFlagsSet">SaveLayerFlagsSet</a> {
<a href="#SkCanvas_kPreserveLCDText_SaveLayerFlag">kPreserveLCDText SaveLayerFlag</a> = 1 << 1,
<a href="#SkCanvas_kInitWithPrevious_SaveLayerFlag">kInitWithPrevious SaveLayerFlag</a> = 1 << 2,
+ <a href="#SkCanvas_kMaskAgainstCoverage_EXPERIMENTAL_DONT_USE_SaveLayerFlag">kMaskAgainstCoverage EXPERIMENTAL DONT USE SaveLayerFlag</a> = 1 << 3,
<a href="#SkCanvas_kDontClipToLayer_Legacy_SaveLayerFlag">kDontClipToLayer Legacy SaveLayerFlag</a> = kDontClipToLayer_PrivateSaveLayerFlag,
};
+
+ typedef uint32_t <a href="#SkCanvas_SaveLayerFlags">SaveLayerFlags</a>;
</pre>
<a href="#SkCanvas_SaveLayerFlags">SaveLayerFlags</a> provides options that may be used in any combination in <a href="#SkCanvas_SaveLayerRec">SaveLayerRec</a>,
@@ -1734,6 +1737,9 @@ defining how <a href="#Layer">Layer</a> allocated by <a href="#SkCanvas_saveLaye
</td>
</tr>
<tr>
+ <td><a name="SkCanvas_kMaskAgainstCoverage_EXPERIMENTAL_DONT_USE_SaveLayerFlag"> <code><strong>SkCanvas::kMaskAgainstCoverage_EXPERIMENTAL_DONT_USE_SaveLayerFlag </strong></code> </a></td><td>8</td><td>Experimental -- don't use</td>
+ </tr>
+ <tr>
<td><a name="SkCanvas_kDontClipToLayer_Legacy_SaveLayerFlag"> <code><strong>SkCanvas::kDontClipToLayer_Legacy_SaveLayerFlag </strong></code> </a></td><td>0x80000000</td><td>soon</td>
</tr>
</table>
diff --git a/site/user/api/SkMatrix_Reference.md b/site/user/api/SkMatrix_Reference.md
index a42edc1a85..6acd4b64a8 100644
--- a/site/user/api/SkMatrix_Reference.md
+++ b/site/user/api/SkMatrix_Reference.md
@@ -121,6 +121,8 @@ improve performance. <a href="#Matrix">Matrix</a> is not thread safe unless <a h
| name | description |
| --- | --- |
+| <a href="#AffineIndex">AffineIndex</a> | affine member indices |
+| <a href="#MemberIndex">MemberIndex</a> | member indices |
| <a href="#Property">Property</a> | values and attributes |
| <a href="#Set">Set</a> | set one or more matrix values |
| <a href="#Transform">Transform</a> | map points with <a href="#Matrix">Matrix</a> |
@@ -792,20 +794,18 @@ Skews are not similar and do not preserve right angles.
---
-## <a name="SkMatrix__anonymous"></a> Enum SkMatrix::_anonymous
+## <a name="MemberIndex"></a> MemberIndex
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
- enum {
- <a href="#SkMatrix_kMScaleX">kMScaleX</a>,
- <a href="#SkMatrix_kMSkewX">kMSkewX</a>,
- <a href="#SkMatrix_kMTransX">kMTransX</a>,
- <a href="#SkMatrix_kMSkewY">kMSkewY</a>,
- <a href="#SkMatrix_kMScaleY">kMScaleY</a>,
- <a href="#SkMatrix_kMTransY">kMTransY</a>,
- <a href="#SkMatrix_kMPersp0">kMPersp0</a>,
- <a href="#SkMatrix_kMPersp1">kMPersp1</a>,
- <a href="#SkMatrix_kMPersp2">kMPersp2</a>,
- };
+ static constexpr int <a href="#SkMatrix_kMScaleX">kMScaleX</a> = 0;
+ static constexpr int <a href="#SkMatrix_kMSkewX">kMSkewX</a> = 1;
+ static constexpr int <a href="#SkMatrix_kMTransX">kMTransX</a> = 2;
+ static constexpr int <a href="#SkMatrix_kMSkewY">kMSkewY</a> = 3;
+ static constexpr int <a href="#SkMatrix_kMScaleY">kMScaleY</a> = 4;
+ static constexpr int <a href="#SkMatrix_kMTransY">kMTransY</a> = 5;
+ static constexpr int <a href="#SkMatrix_kMPersp0">kMPersp0</a> = 6;
+ static constexpr int <a href="#SkMatrix_kMPersp1">kMPersp1</a> = 7;
+ static constexpr int <a href="#SkMatrix_kMPersp2">kMPersp2</a> = 8;
</pre>
<a href="#Matrix">Matrix</a> organizes its values in row order. These members correspond to
@@ -851,19 +851,15 @@ each value in <a href="#Matrix">Matrix</a>.
<a href="#SkMatrix_get">get</a> <a href="#SkMatrix_set">set</a>
-
-
-## <a name="SkMatrix__anonymous_2"></a> Enum SkMatrix::_anonymous_2
+## <a name="AffineIndex"></a> AffineIndex
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
- enum {
- <a href="#SkMatrix_kAScaleX">kAScaleX</a>,
- <a href="#SkMatrix_kASkewY">kASkewY</a>,
- <a href="#SkMatrix_kASkewX">kASkewX</a>,
- <a href="#SkMatrix_kAScaleY">kAScaleY</a>,
- <a href="#SkMatrix_kATransX">kATransX</a>,
- <a href="#SkMatrix_kATransY">kATransY</a>,
- };
+ static constexpr int <a href="#SkMatrix_kAScaleX">kAScaleX</a> = 0;
+ static constexpr int <a href="#SkMatrix_kASkewY">kASkewY</a> = 1;
+ static constexpr int <a href="#SkMatrix_kASkewX">kASkewX</a> = 2;
+ static constexpr int <a href="#SkMatrix_kAScaleY">kAScaleY</a> = 3;
+ static constexpr int <a href="#SkMatrix_kATransX">kATransX</a> = 4;
+ static constexpr int <a href="#SkMatrix_kATransY">kATransY</a> = 5;
</pre>
Affine arrays are in column major order to match the matrix used by
@@ -896,8 +892,6 @@ PDF and XPS.
<a href="#SkMatrix_SetAffineIdentity">SetAffineIdentity</a> <a href="#SkMatrix_asAffine">asAffine</a> <a href="#SkMatrix_setAffine">setAffine</a>
-
-
## <a name="Operator"></a> Operator
| name | description |
diff --git a/site/user/api/SkPaint_Reference.md b/site/user/api/SkPaint_Reference.md
index 03fec2bf37..1be30418fa 100644
--- a/site/user/api/SkPaint_Reference.md
+++ b/site/user/api/SkPaint_Reference.md
@@ -105,8 +105,6 @@ Multiple colors are drawn either by using multiple paints or with objects like
| <a href="#SkPaint_Join">Join</a> | corner geometry on stroked shapes |
| <a href="#SkPaint_Style">Style</a> | stroke, fill, or both |
| <a href="#SkPaint_TextEncoding">TextEncoding</a> | character or glyph encoded size |
-| _anonymous | number of <a href="#SkPaint_Style">Style</a> defines |
-| _anonymous_2 | number of <a href="#Text_Align">Text Align</a> values |
## <a name="Class_or_Struct"></a> Class or Struct
@@ -2075,6 +2073,8 @@ while stroking.
<a href="#SkPaint_kStroke_Style">kStroke Style</a>,
<a href="#SkPaint_kStrokeAndFill_Style">kStrokeAndFill Style</a>,
};
+
+ static constexpr int <a href="#SkPaint_kStyleCount">kStyleCount</a> = <a href="#SkPaint_kStrokeAndFill_Style">kStrokeAndFill Style</a> + 1;
</pre>
Set <a href="#SkPaint_Style">Style</a> to fill, stroke, or both fill and stroke geometry.
@@ -2112,20 +2112,6 @@ Applies to <a href="SkRect_Reference#Rect">Rect</a>, <a href="undocumented#Regio
and the set <a href="SkPath_Reference#Fill_Type">Path Fill Type</a> is ignored.
</td>
</tr>
-
-
-
-## <a name="SkPaint__anonymous"></a> Enum SkPaint::_anonymous
-
-<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
- enum {
- <a href="#SkPaint_kStyleCount">kStyleCount</a> = <a href="#SkPaint_kStrokeAndFill_Style">kStrokeAndFill Style</a> + 1,
- };
-</pre>
-
-### Constants
-
-<table>
<tr>
<td><a name="SkPaint_kStyleCount"> <code><strong>SkPaint::kStyleCount </strong></code> </a></td><td>3</td><td>The number of different <a href="#SkPaint_Style">Style</a> values defined.
May be used to verify that <a href="#SkPaint_Style">Style</a> is a legal value.
@@ -3582,6 +3568,8 @@ void setLooper(sk_sp&lt;SkDrawLooper&gt; drawLooper)
<a href="#SkPaint_kCenter_Align">kCenter Align</a>,
<a href="#SkPaint_kRight_Align">kRight Align</a>,
};
+
+ static constexpr int <a href="#SkPaint_kAlignCount">kAlignCount</a> = 3;
</pre>
<a href="#SkPaint_Align">Align</a> adjusts the text relative to the text position.
@@ -3618,20 +3606,6 @@ half its height if <a href="#SkPaint_Flags">Flags</a> has <a href="#SkPaint_kVer
and by its height if <a href="#SkPaint_Flags">Flags</a> has <a href="#SkPaint_kVerticalText_Flag">kVerticalText Flag</a> set.
</td>
</tr>
-
-
-
-## <a name="SkPaint__anonymous_2"></a> Enum SkPaint::_anonymous_2
-
-<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
- enum {
- <a href="#SkPaint_kAlignCount">kAlignCount</a> = 3,
- };
-</pre>
-
-### Constants
-
-<table>
<tr>
<td><a name="SkPaint_kAlignCount"> <code><strong>SkPaint::kAlignCount </strong></code> </a></td><td>3</td><td>The number of different <a href="#Text_Align">Text Align</a> values defined.
</td>
diff --git a/site/user/api/catalog.htm b/site/user/api/catalog.htm
index c768b74d2a..7f05b27c14 100644
--- a/site/user/api/catalog.htm
+++ b/site/user/api/catalog.htm
@@ -3435,6 +3435,14 @@
"file": "SkImageInfo_Reference",
"name": "Color_Type_RGB_888x"
},
+ "Matrix_MemberIndex": {
+ "code": "void draw(SkCanvas* canvas) {\n SkPaint black;\n black.setAntiAlias(true);\n black.setTextSize(48);\n SkPaint gray = black;\n gray.setColor(0xFF9f9f9f);\n SkScalar offset[] = { 1.5f, 1.5f, 20, 1.5f, 1.5f, 20, .03f, .01f, 2 };\n for (int i : { SkMatrix::kMScaleX, SkMatrix::kMSkewX, SkMatrix::kMTransX,\n SkMatrix::kMSkewY, SkMatrix::kMScaleY, SkMatrix::kMTransY,\n SkMatrix::kMPersp0, SkMatrix::kMPersp1, SkMatrix::kMPersp2 } ) {\n SkMatrix m;\n m.setIdentity();\n m.set(i, offset[i]);\n SkAutoCanvasRestore autoRestore(canvas, true);\n canvas->translate(22 + (i % 3) * 88, 44 + (i / 3) * 88);\n canvas->drawString(\"&\", 0, 0, gray);\n canvas->concat(m);\n canvas->drawString(\"&\", 0, 0, black);\n }\n}",
+ "width": 256,
+ "height": 256,
+ "hash": "3bbf75f4748420810aa2586e3c8548d9",
+ "file": "SkMatrix_Reference",
+ "name": "MemberIndex"
+},
"Paint_Anti_alias": {
"code": "void draw(SkCanvas* canvas) {\n SkBitmap bitmap;\n bitmap.allocN32Pixels(50, 50);\n SkCanvas offscreen(bitmap);\n SkPaint paint;\n paint.setStyle(SkPaint::kStroke_Style);\n paint.setStrokeWidth(10);\n for (bool antialias : { false, true }) {\n paint.setColor(antialias ? SK_ColorRED : SK_ColorBLUE);\n paint.setAntiAlias(antialias);\n bitmap.eraseColor(0);\n offscreen.drawLine(5, 5, 15, 30, paint);\n canvas->drawLine(5, 5, 15, 30, paint);\n canvas->save();\n canvas->scale(10, 10);\n canvas->drawBitmap(bitmap, antialias ? 12 : 0, 0);\n canvas->restore();\n canvas->translate(15, 0);\n }\n}\n",
"width": 512,
@@ -4147,6 +4155,14 @@
"file": "SkCanvas_Reference",
"name": "SkCanvas::PointMode"
},
+ "SkCanvas_SaveLayerFlagsSet": {
+ "code": "void draw(SkCanvas* canvas) {\n SkPaint redPaint, bluePaint, scalePaint;\n redPaint.setColor(SK_ColorRED);\n canvas->drawCircle(21, 21, 8, redPaint);\n bluePaint.setColor(SK_ColorBLUE);\n canvas->drawCircle(31, 21, 8, bluePaint);\n SkMatrix matrix;\n matrix.setScale(4, 4);\n scalePaint.setAlpha(0x40);\n scalePaint.setImageFilter(\n SkImageFilter::MakeMatrixFilter(matrix, kNone_SkFilterQuality, nullptr));\n SkCanvas::SaveLayerRec saveLayerRec(nullptr, &scalePaint,\n SkCanvas::kInitWithPrevious_SaveLayerFlag); \n canvas->saveLayer(saveLayerRec);\n canvas->restore();\n}\n",
+ "width": 256,
+ "height": 160,
+ "hash": "d314c688925d2c549d4762f5cc6e6a1a",
+ "file": "SkCanvas_Reference",
+ "name": "SkCanvas::SaveLayerFlagsSet"
+},
"SkCanvas_SaveLayerRec": {
"code": "void draw(SkCanvas* canvas) {\n SkPaint redPaint, bluePaint;\n redPaint.setAntiAlias(true);\n redPaint.setColor(SK_ColorRED);\n canvas->drawCircle(21, 21, 8, redPaint);\n bluePaint.setColor(SK_ColorBLUE);\n canvas->drawCircle(31, 21, 8, bluePaint);\n SkMatrix matrix;\n matrix.setScale(4, 4);\n auto scaler = SkImageFilter::MakeMatrixFilter(matrix, kNone_SkFilterQuality, nullptr);\n SkCanvas::SaveLayerRec saveLayerRec(nullptr, nullptr, scaler.get(), 0); \n canvas->saveLayer(saveLayerRec);\n canvas->drawCircle(125, 85, 8, redPaint);\n canvas->restore();\n}\n",
"width": 256,
@@ -4163,14 +4179,6 @@
"file": "SkCanvas_Reference",
"name": "SkCanvas::SrcRectConstraint"
},
- "SkCanvas__anonymous": {
- "code": "void draw(SkCanvas* canvas) {\n SkPaint redPaint, bluePaint, scalePaint;\n redPaint.setColor(SK_ColorRED);\n canvas->drawCircle(21, 21, 8, redPaint);\n bluePaint.setColor(SK_ColorBLUE);\n canvas->drawCircle(31, 21, 8, bluePaint);\n SkMatrix matrix;\n matrix.setScale(4, 4);\n scalePaint.setAlpha(0x40);\n scalePaint.setImageFilter(\n SkImageFilter::MakeMatrixFilter(matrix, kNone_SkFilterQuality, nullptr));\n SkCanvas::SaveLayerRec saveLayerRec(nullptr, &scalePaint,\n SkCanvas::kInitWithPrevious_SaveLayerFlag); \n canvas->saveLayer(saveLayerRec);\n canvas->restore();\n}\n",
- "width": 256,
- "height": 160,
- "hash": "d314c688925d2c549d4762f5cc6e6a1a",
- "file": "SkCanvas_Reference",
- "name": "SkCanvas::_anonymous"
-},
"SkCanvas_accessTopLayerPixels": {
"code": "void draw(SkCanvas* canvas) {\n if (canvas->accessTopLayerPixels(nullptr, nullptr)) {\n canvas->clear(SK_ColorRED);\n } else {\n canvas->clear(SK_ColorBLUE);\n }\n}\n",
"width": 256,
@@ -5699,14 +5707,6 @@
"file": "SkMatrix_Reference",
"name": "SkMatrix::ScaleToFit"
},
- "SkMatrix__anonymous": {
- "code": "void draw(SkCanvas* canvas) {\n SkPaint black;\n black.setAntiAlias(true);\n black.setTextSize(48);\n SkPaint gray = black;\n gray.setColor(0xFF9f9f9f);\n SkScalar offset[] = { 1.5f, 1.5f, 20, 1.5f, 1.5f, 20, .03f, .01f, 2 };\n for (int i : { SkMatrix::kMScaleX, SkMatrix::kMSkewX, SkMatrix::kMTransX,\n SkMatrix::kMSkewY, SkMatrix::kMScaleY, SkMatrix::kMTransY,\n SkMatrix::kMPersp0, SkMatrix::kMPersp1, SkMatrix::kMPersp2 } ) {\n SkMatrix m;\n m.setIdentity();\n m.set(i, offset[i]);\n SkAutoCanvasRestore autoRestore(canvas, true);\n canvas->translate(22 + (i % 3) * 88, 44 + (i / 3) * 88);\n canvas->drawString(\"&\", 0, 0, gray);\n canvas->concat(m);\n canvas->drawString(\"&\", 0, 0, black);\n }\n}",
- "width": 256,
- "height": 256,
- "hash": "3bbf75f4748420810aa2586e3c8548d9",
- "file": "SkMatrix_Reference",
- "name": "SkMatrix::_anonymous"
-},
"SkMatrix_fixedStepInX": {
"code": "void draw(SkCanvas* canvas) {\n SkMatrix matrix;\n const SkPoint center = { 128, 128 };\n matrix.setScale(20, 25, center.fX, center.fY);\n matrix.postRotate(75, center.fX, center.fY);\n {\n SkAutoCanvasRestore acr(canvas, true);\n canvas->concat(matrix);\n canvas->drawBitmap(source, 0, 0);\n }\n if (matrix.isFixedStepInX()) {\n SkPaint paint;\n paint.setAntiAlias(true);\n SkVector step = matrix.fixedStepInX(128);\n SkVector end = center + step;\n canvas->drawLine(center, end, paint);\n SkVector arrow = { step.fX + step.fY, step.fY - step.fX};\n arrow = arrow * .25f;\n canvas->drawLine(end, end - arrow, paint);\n canvas->drawLine(end, {end.fX + arrow.fY, end.fY - arrow.fX}, paint);\n }\n}",
"width": 256,
diff --git a/tools/bookmaker/bookmaker.h b/tools/bookmaker/bookmaker.h
index 62f2faa34b..7e09d41afd 100644
--- a/tools/bookmaker/bookmaker.h
+++ b/tools/bookmaker/bookmaker.h
@@ -1010,6 +1010,7 @@ private:
};
struct IClassDefinition : public Definition {
+ unordered_map<string, Definition*> fConsts;
unordered_map<string, Definition*> fDefines;
unordered_map<string, Definition*> fEnums;
unordered_map<string, Definition*> fMembers;
@@ -1478,7 +1479,7 @@ public:
, { nullptr, MarkType::kCode }
, { nullptr, MarkType::kColumn }
, { nullptr, MarkType::kComment }
- , { nullptr, MarkType::kConst }
+ , { &fIConstMap, MarkType::kConst }
, { &fIDefineMap, MarkType::kDefine }
, { nullptr, MarkType::kDefinedBy }
, { nullptr, MarkType::kDeprecated }
@@ -1603,6 +1604,7 @@ public:
bool parseComment(string filename, const char* start, const char* end, int lineCount,
Definition* markupDef);
bool parseClass(Definition* def, IsStruct);
+ bool parseConst(Definition* child, Definition* markupDef);
bool parseDefine(Definition* child, Definition* markupDef);
bool parseEnum(Definition* child, Definition* markupDef);
@@ -1830,6 +1832,7 @@ protected:
unordered_map<string, Definition> fIncludeMap;
list<Definition> fGlobals;
unordered_map<string, IClassDefinition> fIClassMap;
+ unordered_map<string, Definition*> fIConstMap;
unordered_map<string, Definition*> fIDefineMap;
unordered_map<string, Definition*> fIEnumMap;
unordered_map<string, Definition*> fIFunctionMap;
@@ -2326,3 +2329,4 @@ private:
bool SelfCheck(const BmhParser& );
#endif
+
diff --git a/tools/bookmaker/includeParser.cpp b/tools/bookmaker/includeParser.cpp
index 982f7b3a78..ebc2384d61 100644
--- a/tools/bookmaker/includeParser.cpp
+++ b/tools/bookmaker/includeParser.cpp
@@ -466,6 +466,14 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
fFailed = true;
}
break;
+ case MarkType::kConst:
+ if (def) {
+ def->fVisited = true;
+ } else if (!root->fDeprecated) {
+ SkDebugf("const missing from bmh: %s\n", fullName.c_str());
+ fFailed = true;
+ }
+ break;
default:
SkASSERT(0); // unhandled
break;
@@ -1420,6 +1428,50 @@ bool IncludeParser::parseComment(string filename, const char* start, const char*
return true;
}
+bool IncludeParser::parseConst(Definition* child, Definition* markupDef) {
+ // todo: hard code to constexpr for now
+ TextParser constParser(child);
+ if (!constParser.skipExact("static")) {
+ return false;
+ }
+ constParser.skipWhiteSpace();
+ if (!constParser.skipExact("constexpr")) {
+ return false;
+ }
+ constParser.skipWhiteSpace();
+ const char* typeStart = constParser.fChar;
+ constParser.skipToSpace();
+ KeyWord constType = FindKey(typeStart, constParser.fChar);
+ if (KeyWord::kNone == constType) {
+ // todo: this could be a non-keyword, ... do we need to look for type?
+ return false;
+ }
+ constParser.skipWhiteSpace();
+ const char* nameStart = constParser.fChar;
+ constParser.skipToSpace();
+ string nameStr = string(nameStart, constParser.fChar - nameStart);
+ if (!markupDef) {
+ fGlobals.emplace_back(MarkType::kConst, child->fContentStart, child->fContentEnd,
+ child->fLineCount, fParent, '\0');
+ Definition* globalMarkupChild = &fGlobals.back();
+ string globalUniqueName = this->uniqueName(fIConstMap, nameStr);
+ globalMarkupChild->fName = globalUniqueName;
+ if (!this->findComments(*child, globalMarkupChild)) {
+ return false;
+ }
+ fIConstMap[globalUniqueName] = globalMarkupChild;
+ return true;
+ }
+ markupDef->fTokens.emplace_back(MarkType::kConst, child->fContentStart, child->fContentEnd,
+ child->fLineCount, markupDef, '\0');
+ Definition* markupChild = &markupDef->fTokens.back();
+ markupChild->fName = nameStr;
+ markupChild->fTerminator = markupChild->fContentEnd;
+ IClassDefinition& classDef = fIClassMap[markupDef->fName];
+ classDef.fConsts[nameStr] = markupChild;
+ return true;
+}
+
bool IncludeParser::parseDefine(Definition* child, Definition* markupDef) {
TextParser parser(child);
if (!parser.skipExact("#define")) {
@@ -1902,6 +1954,11 @@ bool IncludeParser::parseObject(Definition* child, Definition* markupDef) {
return false;
}
break;
+ case KeyWord::kStatic:
+ if (!this->parseConst(child, markupDef)) {
+ return child->reportError<bool>("failed to parse const or constexpr");
+ }
+ break;
case KeyWord::kEnum:
if (!this->parseEnum(child, markupDef)) {
return child->reportError<bool>("failed to parse enum");
@@ -2468,6 +2525,43 @@ bool IncludeParser::parseChar() {
fPriorEnum = priorEnum;
}
}
+ } else { // check for static constexpr not following an enum
+ // find first token on line
+ auto backTokenWalker = fParent->fTokens.end();
+ while (fParent->fTokens.begin() != backTokenWalker
+ && (fParent->fTokens.end() == backTokenWalker
+ || backTokenWalker->fStart > fLine)) {
+ std::advance(backTokenWalker, -1);
+ }
+ if (fParent->fTokens.end() != backTokenWalker
+ && backTokenWalker->fStart < fLine) {
+ std::advance(backTokenWalker, 1);
+ }
+ // look for static constexpr
+ Definition* start = &*backTokenWalker;
+ bool foundExpected = true;
+ for (KeyWord expected : {KeyWord::kStatic, KeyWord::kConstExpr}){
+ const Definition* test = &*backTokenWalker;
+ if (expected != test->fKeyWord) {
+ foundExpected = false;
+ break;
+ }
+ if (backTokenWalker == fParent->fTokens.end()) {
+ break;
+ }
+ std::advance(backTokenWalker, 1);
+ }
+ if (foundExpected) {
+ std::advance(backTokenWalker, 1);
+ const char* nameStart = backTokenWalker->fStart;
+ std::advance(backTokenWalker, 1);
+ TextParser parser(fFileName, nameStart, backTokenWalker->fStart, fLineCount);
+ parser.skipToNonAlphaNum();
+ start->fMarkType = MarkType::kConst;
+ start->fName = string(nameStart, parser.fChar - nameStart);
+ start->fContentEnd = backTokenWalker->fContentEnd;
+ fParent->fChildren.emplace_back(start);
+ }
}
}
this->addPunctuation(Punctuation::kSemicolon);
diff --git a/tools/bookmaker/includeWriter.cpp b/tools/bookmaker/includeWriter.cpp
index daf4c36145..e2ba6c67b8 100644
--- a/tools/bookmaker/includeWriter.cpp
+++ b/tools/bookmaker/includeWriter.cpp
@@ -1435,7 +1435,7 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti
default:
SkASSERT(0);
}
- if (KeyWord::kUint8_t == child.fKeyWord) {
+ if (KeyWord::kUint8_t == child.fKeyWord || KeyWord::kUint32_t == child.fKeyWord) {
continue;
} else {
if (fInEnum && KeyWord::kClass == child.fChildren[0]->fKeyWord) {