diff options
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkCanvas.h | 14 | ||||
-rw-r--r-- | include/core/SkDrawFilter.h | 4 | ||||
-rw-r--r-- | include/core/SkFont.h | 4 | ||||
-rw-r--r-- | include/core/SkImageGenerator.h | 4 | ||||
-rw-r--r-- | include/core/SkMatrix.h | 84 | ||||
-rw-r--r-- | include/core/SkMatrix44.h | 6 | ||||
-rw-r--r-- | include/core/SkPaint.h | 46 | ||||
-rw-r--r-- | include/core/SkPixelRef.h | 2 | ||||
-rw-r--r-- | include/core/SkRRect.h | 4 | ||||
-rw-r--r-- | include/core/SkRegion.h | 18 | ||||
-rw-r--r-- | include/core/SkShader.h | 4 | ||||
-rw-r--r-- | include/core/SkStrokeRec.h | 5 | ||||
-rw-r--r-- | include/core/SkYUVSizeInfo.h | 2 |
13 files changed, 82 insertions, 115 deletions
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, |