aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-11-28 18:22:01 +0000
committerGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-11-28 18:22:01 +0000
commit01224d5d0a3228fe47e63d8346e0e433a87563a8 (patch)
tree0c26fce36c2f958139e0d52c447d19b1f5e052d6 /include
parent5e12770cb01d9f6963538223cbfd91d269feee98 (diff)
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
Diffstat (limited to 'include')
-rw-r--r--include/core/SkEndian.h13
-rw-r--r--include/core/SkTypes.h2
-rw-r--r--include/gpu/GrTypes.h2
3 files changed, 16 insertions, 1 deletions
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 <typename T> const T& GrMin(const T& a, const T& b) {
return (a < b) ? a : b;