From 01224d5d0a3228fe47e63d8346e0e433a87563a8 Mon Sep 17 00:00:00 2001 From: "tomhudson@google.com" Date: Mon, 28 Nov 2011 18:22:01 +0000 Subject: Unroll loops in SkBlurMask for speedup on Windows (benchmarks should see 15% on interpolated blurs, 5-10% on simple blurs). git-svn-id: http://skia.googlecode.com/svn/trunk@2755 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkEndian.h | 13 +++++++++++++ include/core/SkTypes.h | 2 ++ include/gpu/GrTypes.h | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/core/SkEndian.h b/include/core/SkEndian.h index d7dd562cf1..3eb67dabfe 100644 --- a/include/core/SkEndian.h +++ b/include/core/SkEndian.h @@ -80,6 +80,19 @@ static inline void SkEndianSwap32s(uint32_t array[], int count) { #define SkEndian_SwapLE32(n) SkEndianSwap32(n) #endif +// When a bytestream is embedded in a 32-bit word, how far we need to +// shift the word to extract each byte from the low 8 bits by anding with 0xff. +#ifdef SK_CPU_LENDIAN + #define SkEndian_Byte0Shift 0 + #define SkEndian_Byte1Shift 8 + #define SkEndian_Byte2Shift 16 + #define SkEndian_Byte3Shift 24 +#else // SK_CPU_BENDIAN + #define SkEndian_Byte0Shift 24 + #define SkEndian_Byte1Shift 16 + #define SkEndian_Byte2Shift 8 + #define SkEndian_Byte3Shift 0 +#endif #endif diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index 1ee25b129a..51d8d187c7 100644 --- a/include/core/SkTypes.h +++ b/include/core/SkTypes.h @@ -216,6 +216,8 @@ static inline bool SkIsU16(long x) { */ #define SkAlign4(x) (((x) + 3) >> 2 << 2) +#define SkIsAlign4(x) (((x) & 3) == 0) + typedef uint32_t SkFourByteTag; #define SkSetFourByteTag(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index eb92f09eb7..e961fac805 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -55,7 +55,7 @@ * n is already a multiple of 4 */ #define GrALIGN4(n) SkAlign4(n) -#define GrIsALIGN4(n) (((n) & 3) == 0) +#define GrIsALIGN4(n) SkIsAlign4(n) template const T& GrMin(const T& a, const T& b) { return (a < b) ? a : b; -- cgit v1.2.3