diff options
author | 2013-12-20 14:24:21 +0000 | |
---|---|---|
committer | 2013-12-20 14:24:21 +0000 | |
commit | 01c41a556e0ef0ae2338a1b5ae110a501e1ed0a8 (patch) | |
tree | 161c3eeed7af2413719cd04c5cb9a627ffcc2537 /include/core | |
parent | 5f2fd5dd5d6dbf3057258d652aacfc9d664132a2 (diff) |
Revert "Revert "begin to remove SkLONGLONG and wean Skia off of Sk64""
This reverts commit 15b986baf026a3da5e2cac8106a1b753df242c39.
BUG=
Review URL: https://codereview.chromium.org/119353003
git-svn-id: http://skia.googlecode.com/svn/trunk@12796 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/Sk64.h | 13 | ||||
-rw-r--r-- | include/core/SkFixed.h | 18 | ||||
-rw-r--r-- | include/core/SkPostConfig.h | 10 |
3 files changed, 16 insertions, 25 deletions
diff --git a/include/core/Sk64.h b/include/core/Sk64.h index eba8b684c6..009744938f 100644 --- a/include/core/Sk64.h +++ b/include/core/Sk64.h @@ -17,9 +17,17 @@ Sk64 is a 64-bit math package that does not require long long support from the compiler. */ struct SK_API Sk64 { +private: int32_t fHi; //!< the high 32 bits of the number (including sign) uint32_t fLo; //!< the low 32 bits of the number +public: + int32_t hi() const { return fHi; } + uint32_t lo() const { return fLo; } + + int64_t as64() const { return ((int64_t)fHi << 32) | fLo; } + int64_t getLongLong() const { return this->as64(); } + /** Returns non-zero if the Sk64 can be represented as a signed 32 bit integer */ SkBool is32() const { return fHi == ((int32_t)fLo >> 31); } @@ -169,9 +177,8 @@ struct SK_API Sk64 { return a.fHi > b.fHi || (a.fHi == b.fHi && a.fLo >= b.fLo); } -#ifdef SkLONGLONG - SkLONGLONG getLongLong() const; -#endif + // Private to unittests. Parameter is (skiatest::Reporter*) + static void UnitTestWithReporter(void* skiatest_reporter); }; #endif diff --git a/include/core/SkFixed.h b/include/core/SkFixed.h index 580d94b9ca..e63794e862 100644 --- a/include/core/SkFixed.h +++ b/include/core/SkFixed.h @@ -86,17 +86,6 @@ typedef int32_t SkFixed; #define SkFixedAve(a, b) (((a) + (b)) >> 1) SkFixed SkFixedMul_portable(SkFixed, SkFixed); -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) @@ -118,14 +107,9 @@ static inline SkFixed SkFixedCos(SkFixed radians) { #ifdef SkLONGLONG inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b) { - return (SkFixed)((SkLONGLONG)a * b >> 16); - } - inline SkFixed SkFixedSquare_longlong(SkFixed value) - { - return (SkFixed)((SkLONGLONG)value * value >> 16); + return (SkFixed)((int64_t)a * b >> 16); } #define SkFixedMul(a,b) SkFixedMul_longlong(a,b) - #define SkFixedSquare(a) SkFixedSquare_longlong(a) #endif #if defined(SK_CPU_ARM) diff --git a/include/core/SkPostConfig.h b/include/core/SkPostConfig.h index 323d1e8b6d..2156519b2d 100644 --- a/include/core/SkPostConfig.h +++ b/include/core/SkPostConfig.h @@ -227,13 +227,13 @@ ////////////////////////////////////////////////////////////////////// +// TODO: rebaseline as needed so we can remove this flag entirely. +// - all platforms have int64_t now +// - we have slightly different fixed math results because of this check +// since we don't define this for linux/android #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 +# define SkLONGLONG int64_t # endif #endif |