Add SK_BEGIN_REQUIRE_DENSE / SK_END_REQUIRE_DENSE.
Use in on a few examples of things we hash. BUG=skia: Review URL: https://codereview.chromium.org/1468483002
This commit is contained in:
parent
d14c39eff2
commit
b68ce74bd1
@ -22,6 +22,7 @@ class SkString;
|
|||||||
using either reset() - to construct an identity matrix, or one of the set
|
using either reset() - to construct an identity matrix, or one of the set
|
||||||
functions (e.g. setTranslate, setRotate, etc.).
|
functions (e.g. setTranslate, setRotate, etc.).
|
||||||
*/
|
*/
|
||||||
|
SK_BEGIN_REQUIRE_DENSE
|
||||||
class SK_API SkMatrix {
|
class SK_API SkMatrix {
|
||||||
public:
|
public:
|
||||||
static SkMatrix SK_WARN_UNUSED_RESULT MakeScale(SkScalar sx, SkScalar sy) {
|
static SkMatrix SK_WARN_UNUSED_RESULT MakeScale(SkScalar sx, SkScalar sy) {
|
||||||
@ -826,5 +827,6 @@ private:
|
|||||||
|
|
||||||
friend class SkPerspIter;
|
friend class SkPerspIter;
|
||||||
};
|
};
|
||||||
|
SK_END_REQUIRE_DENSE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
class SkPath;
|
class SkPath;
|
||||||
|
|
||||||
|
SK_BEGIN_REQUIRE_DENSE
|
||||||
class SkStrokeRec {
|
class SkStrokeRec {
|
||||||
public:
|
public:
|
||||||
enum InitStyle {
|
enum InitStyle {
|
||||||
@ -125,5 +126,6 @@ private:
|
|||||||
uint32_t fJoin : 15; // SkPaint::Join
|
uint32_t fJoin : 15; // SkPaint::Join
|
||||||
uint32_t fStrokeAndFill : 1; // bool
|
uint32_t fStrokeAndFill : 1; // bool
|
||||||
};
|
};
|
||||||
|
SK_END_REQUIRE_DENSE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -287,6 +287,16 @@ static inline bool SkIsU16(long x) {
|
|||||||
template <typename T, size_t N> char (&SkArrayCountHelper(T (&array)[N]))[N];
|
template <typename T, size_t N> char (&SkArrayCountHelper(T (&array)[N]))[N];
|
||||||
#define SK_ARRAY_COUNT(array) (sizeof(SkArrayCountHelper(array)))
|
#define SK_ARRAY_COUNT(array) (sizeof(SkArrayCountHelper(array)))
|
||||||
|
|
||||||
|
// Can be used to bracket data types that must be dense, e.g. hash keys.
|
||||||
|
#if defined(__clang__) // This should work on GCC too, but GCC diagnostic pop didn't seem to work!
|
||||||
|
#define SK_BEGIN_REQUIRE_DENSE _Pragma("GCC diagnostic push") \
|
||||||
|
_Pragma("GCC diagnostic error \"-Wpadded\"")
|
||||||
|
#define SK_END_REQUIRE_DENSE _Pragma("GCC diagnostic pop")
|
||||||
|
#else
|
||||||
|
#define SK_BEGIN_REQUIRE_DENSE
|
||||||
|
#define SK_END_REQUIRE_DENSE
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SkAlign2(x) (((x) + 1) >> 1 << 1)
|
#define SkAlign2(x) (((x) + 1) >> 1 << 1)
|
||||||
#define SkIsAlign2(x) (0 == ((x) & 1))
|
#define SkIsAlign2(x) (0 == ((x) & 1))
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ class SkGlyphCache;
|
|||||||
|
|
||||||
#define kMaxGlyphWidth (1<<13)
|
#define kMaxGlyphWidth (1<<13)
|
||||||
|
|
||||||
|
SK_BEGIN_REQUIRE_DENSE
|
||||||
class SkGlyph {
|
class SkGlyph {
|
||||||
enum {
|
enum {
|
||||||
kSubBits = 2,
|
kSubBits = 2,
|
||||||
@ -182,5 +183,6 @@ class SkGlyph {
|
|||||||
#endif
|
#endif
|
||||||
uint32_t fID;
|
uint32_t fID;
|
||||||
};
|
};
|
||||||
|
SK_END_REQUIRE_DENSE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user