author | Ehsan Akhgari <ehsan@mozilla.com> |
Fri, 18 Oct 2013 20:34:57 -0400 | |
changeset 165251 | a768721b6085663f178094b00dee368a65f3c35d |
parent 165250 | 297c9911e26a5d88aea76ae587cbdfae277afe40 |
child 165252 | cf1b692cd29ad58c59f3a463b9360ffdb69a39f8 |
push id | 3066 |
push user | akeybl@mozilla.com |
push date | Mon, 09 Dec 2013 19:58:46 +0000 |
treeherder | mozilla-beta@a31a0dce83aa [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bsmedberg |
bugs | 928054 |
milestone | 27.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/content/svg/content/src/SVGPathSegUtils.h +++ b/content/svg/content/src/SVGPathSegUtils.h @@ -4,17 +4,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef MOZILLA_SVGPATHSEGUTILS_H__ #define MOZILLA_SVGPATHSEGUTILS_H__ #include "gfxPoint.h" #include "nsDebug.h" #include "nsMemory.h" -#include "prtypes.h" namespace mozilla { // Path Segment Types static const unsigned short PATHSEG_UNKNOWN = 0; static const unsigned short PATHSEG_CLOSEPATH = 1; static const unsigned short PATHSEG_MOVETO_ABS = 2; static const unsigned short PATHSEG_MOVETO_REL = 3; @@ -108,23 +107,23 @@ public: * * At some point in the future we will likely want to encode other * information into the float, such as whether the command was explicit or * not. For now all this method does is save on int to float runtime * conversion by requiring uint32_t and float to be of the same size so we * can simply do a bitwise uint32_t<->float copy. */ static float EncodeType(uint32_t aType) { - PR_STATIC_ASSERT(sizeof(uint32_t) == sizeof(float)); + static_assert(sizeof(uint32_t) == sizeof(float), "sizeof uint32_t and float must be the same"); NS_ABORT_IF_FALSE(IsValidType(aType), "Seg type not recognized"); return *(reinterpret_cast<float*>(&aType)); } static uint32_t DecodeType(float aType) { - PR_STATIC_ASSERT(sizeof(uint32_t) == sizeof(float)); + static_assert(sizeof(uint32_t) == sizeof(float), "sizeof uint32_t and float must be the same"); uint32_t type = *(reinterpret_cast<uint32_t*>(&aType)); NS_ABORT_IF_FALSE(IsValidType(type), "Seg type not recognized"); return type; } static PRUnichar GetPathSegTypeAsLetter(uint32_t aType) { NS_ABORT_IF_FALSE(IsValidType(aType), "Seg type not recognized"); @@ -145,17 +144,17 @@ public: PRUnichar('h'), // 13 == PATHSEG_LINETO_HORIZONTAL_REL PRUnichar('V'), // 14 == PATHSEG_LINETO_VERTICAL_ABS PRUnichar('v'), // 15 == PATHSEG_LINETO_VERTICAL_REL PRUnichar('S'), // 16 == PATHSEG_CURVETO_CUBIC_SMOOTH_ABS PRUnichar('s'), // 17 == PATHSEG_CURVETO_CUBIC_SMOOTH_REL PRUnichar('T'), // 18 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS PRUnichar('t') // 19 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL }; - PR_STATIC_ASSERT(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT); + static_assert(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT, "Unexpected table size"); return table[aType]; } static uint32_t ArgCountForType(uint32_t aType) { NS_ABORT_IF_FALSE(IsValidType(aType), "Seg type not recognized"); static const uint8_t table[] = { @@ -175,17 +174,17 @@ public: 1, // 13 == PATHSEG_LINETO_HORIZONTAL_REL 1, // 14 == PATHSEG_LINETO_VERTICAL_ABS 1, // 15 == PATHSEG_LINETO_VERTICAL_REL 4, // 16 == PATHSEG_CURVETO_CUBIC_SMOOTH_ABS 4, // 17 == PATHSEG_CURVETO_CUBIC_SMOOTH_REL 2, // 18 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS 2 // 19 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL }; - PR_STATIC_ASSERT(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT); + static_assert(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT, "Unexpected table size"); return table[aType]; } /** * Convenience so that callers can pass a float containing an encoded type * and have it decoded implicitly. */ @@ -217,44 +216,44 @@ public: aType == PATHSEG_ARC_REL; } static bool IsRelativeOrAbsoluteType(uint32_t aType) { NS_ABORT_IF_FALSE(IsValidType(aType), "Seg type not recognized"); // When adding a new path segment type, ensure that the returned condition // below is still correct. - PR_STATIC_ASSERT(NS_SVG_PATH_SEG_LAST_VALID_TYPE == - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL); + static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, + "Unexpected type"); return aType >= PATHSEG_MOVETO_ABS; } static bool IsRelativeType(uint32_t aType) { NS_ABORT_IF_FALSE (IsRelativeOrAbsoluteType(aType), "IsRelativeType called with segment type that does not come in relative and absolute forms"); // When adding a new path segment type, ensure that the returned condition // below is still correct. - PR_STATIC_ASSERT(NS_SVG_PATH_SEG_LAST_VALID_TYPE == - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL); + static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, + "Unexpected type"); return aType & 1; } static uint32_t RelativeVersionOfType(uint32_t aType) { NS_ABORT_IF_FALSE (IsRelativeOrAbsoluteType(aType), "RelativeVersionOfType called with segment type that does not come in relative and absolute forms"); // When adding a new path segment type, ensure that the returned condition // below is still correct. - PR_STATIC_ASSERT(NS_SVG_PATH_SEG_LAST_VALID_TYPE == - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL); + static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, + "Unexpected type"); return aType | 1; } static uint32_t SameTypeModuloRelativeness(uint32_t aType1, uint32_t aType2) { if (!IsRelativeOrAbsoluteType(aType1)) { return aType1 == aType2; }