diff options
author | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-15 13:43:23 +0000 |
---|---|---|
committer | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-15 13:43:23 +0000 |
commit | 0e6e8cc627242cc7e301401cfe112ba98a008101 (patch) | |
tree | f2bbce7d1b582f87d671d1b0f7adeef0e11ea5e8 /include/core | |
parent | ed41d86a956a84e1438e334c15641393d68cf606 (diff) |
Revert r10705 (ARM Skia NEON patches - 04 - Clean SkFixed / SkLONGLONG) due to 1000+ linux_layout failures (http://build.chromium.org/p/tryserver.chromium/builders/linux_layout_rel/builds/18997/steps/webkit_tests/logs/stdio)
git-svn-id: http://skia.googlecode.com/svn/trunk@10729 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/Sk64.h | 4 | ||||
-rw-r--r-- | include/core/SkFixed.h | 57 | ||||
-rw-r--r-- | include/core/SkPostConfig.h | 11 |
3 files changed, 53 insertions, 19 deletions
diff --git a/include/core/Sk64.h b/include/core/Sk64.h index 47ec15e0d3..6db3001fb5 100644 --- a/include/core/Sk64.h +++ b/include/core/Sk64.h @@ -221,6 +221,10 @@ struct SK_API Sk64 { friend bool operator>=(const Sk64& a, const Sk64& b) { return a.fHi > b.fHi || (a.fHi == b.fHi && a.fLo >= b.fLo); } + +#ifdef SkLONGLONG + SkLONGLONG getLongLong() const; +#endif }; #endif diff --git a/include/core/SkFixed.h b/include/core/SkFixed.h index a4a515d30a..acfbe9af95 100644 --- a/include/core/SkFixed.h +++ b/include/core/SkFixed.h @@ -120,6 +120,20 @@ inline SkFixed SkFixedFraction(SkFixed x) #define SkFixedAbs(x) SkAbs32(x) #define SkFixedAve(a, b) (((a) + (b)) >> 1) +SkFixed SkFixedMul_portable(SkFixed, SkFixed); +SkFract SkFractMul_portable(SkFract, SkFract); +inline SkFixed SkFixedSquare_portable(SkFixed value) +{ + uint32_t a = SkAbs32(value); + uint32_t ah = a >> 16; + uint32_t al = a & 0xFFFF; + SkFixed result = ah * a + al * ah + (al * al >> 16); + if (result >= 0) + return result; + else // Overflow. + return SK_FixedMax; +} + #define SkFixedDiv(numer, denom) SkDivBits(numer, denom, 16) SkFixed SkFixedDivInt(int32_t numer, int32_t denom); SkFixed SkFixedMod(SkFixed numer, SkFixed denom); @@ -155,28 +169,27 @@ inline bool SkFixedNearlyZero(SkFixed x, SkFixed tolerance = SK_FixedNearlyZero) return SkAbs32(x) < tolerance; } -inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b) -{ - return (SkFixed)((int64_t)a * b >> 16); -} - -inline SkFract SkFractMul_longlong(SkFract a, SkFract b) -{ - return (SkFract)((int64_t)a * b >> 30); -} - -inline SkFixed SkFixedSquare_longlong(SkFixed value) -{ - return (SkFixed)((int64_t)value * value >> 16); -} - -#define SkFixedMul(a,b) SkFixedMul_longlong(a,b) -#define SkFractMul(a,b) SkFractMul_longlong(a,b) -#define SkFixedSquare(a) SkFixedSquare_longlong(a) - ////////////////////////////////////////////////////////////////////////////////////////////////////// // Now look for ASM overrides for our portable versions (should consider putting this in its own file) +#ifdef SkLONGLONG + inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b) + { + return (SkFixed)((SkLONGLONG)a * b >> 16); + } + inline SkFract SkFractMul_longlong(SkFract a, SkFract b) + { + return (SkFract)((SkLONGLONG)a * b >> 30); + } + inline SkFixed SkFixedSquare_longlong(SkFixed value) + { + return (SkFixed)((SkLONGLONG)value * value >> 16); + } + #define SkFixedMul(a,b) SkFixedMul_longlong(a,b) + #define SkFractMul(a,b) SkFractMul_longlong(a,b) + #define SkFixedSquare(a) SkFixedSquare_longlong(a) +#endif + #if defined(SK_CPU_ARM) /* This guy does not handle NaN or other obscurities, but is faster than than (int)(x*65536) @@ -249,6 +262,12 @@ inline SkFixed SkFixedSquare_longlong(SkFixed value) #ifndef SkFixedSquare #define SkFixedSquare(x) SkFixedSquare_portable(x) #endif +#ifndef SkFixedMul + #define SkFixedMul(x, y) SkFixedMul_portable(x, y) +#endif +#ifndef SkFractMul + #define SkFractMul(x, y) SkFractMul_portable(x, y) +#endif #ifndef SkFixedMulAdd #define SkFixedMulAdd(x, y, a) (SkFixedMul(x, y) + (a)) #endif diff --git a/include/core/SkPostConfig.h b/include/core/SkPostConfig.h index e992f42916..4a819d369a 100644 --- a/include/core/SkPostConfig.h +++ b/include/core/SkPostConfig.h @@ -269,6 +269,17 @@ ////////////////////////////////////////////////////////////////////// +#if defined(SK_BUILD_FOR_WIN32) || defined(SK_BUILD_FOR_MAC) + #ifndef SkLONGLONG + #ifdef SK_BUILD_FOR_WIN32 + #define SkLONGLONG __int64 + #else + #define SkLONGLONG long long + #endif + #endif +#endif + +////////////////////////////////////////////////////////////////////////////////////////////// #ifndef SK_BUILD_FOR_WINCE #include <string.h> #include <stdlib.h> |