diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-19 21:54:27 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-19 21:54:27 +0000 |
commit | d6a301e9adfe465cbaf682963b3bd43d7fcebedc (patch) | |
tree | 3943195e538f22e87b6126b181ddf474db02ce02 /include | |
parent | 3f2028e3e6edc06cda996b4ff59a4befae8798cd (diff) |
begin to remove SkLONGLONG and wean Skia off of Sk64
BUG=
R=caryclark@google.com
Review URL: https://codereview.chromium.org/99433009
git-svn-id: http://skia.googlecode.com/svn/trunk@12788 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/config/SkUserConfig.h | 6 | ||||
-rw-r--r-- | include/core/Sk64.h | 13 | ||||
-rw-r--r-- | include/core/SkFixed.h | 4 | ||||
-rw-r--r-- | include/core/SkPostConfig.h | 10 | ||||
-rw-r--r-- | include/utils/SkCamera.h | 5 |
5 files changed, 17 insertions, 21 deletions
diff --git a/include/config/SkUserConfig.h b/include/config/SkUserConfig.h index 534c79dde1..ec791d9a50 100644 --- a/include/config/SkUserConfig.h +++ b/include/config/SkUserConfig.h @@ -88,12 +88,6 @@ //#define SK_UINT8_BITFIELD_LENDIAN -/* Some compilers don't support long long for 64bit integers. If yours does - not, define this to the appropriate type. - */ -//#define SkLONGLONG int64_t - - /* To write debug messages to a console, skia will call SkDebugf(...) following printf conventions (e.g. const char* format, ...). If you want to redirect this to something other than printf, define yours here 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..42a9eec284 100644 --- a/include/core/SkFixed.h +++ b/include/core/SkFixed.h @@ -118,11 +118,11 @@ static inline SkFixed SkFixedCos(SkFixed radians) { #ifdef SkLONGLONG inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b) { - return (SkFixed)((SkLONGLONG)a * b >> 16); + return (SkFixed)((int64_t)a * b >> 16); } inline SkFixed SkFixedSquare_longlong(SkFixed value) { - return (SkFixed)((SkLONGLONG)value * value >> 16); + return (SkFixed)((int64_t)value * value >> 16); } #define SkFixedMul(a,b) SkFixedMul_longlong(a,b) #define SkFixedSquare(a) SkFixedSquare_longlong(a) 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 diff --git a/include/utils/SkCamera.h b/include/utils/SkCamera.h index ad74c81d2f..2e5e3423bb 100644 --- a/include/utils/SkCamera.h +++ b/include/utils/SkCamera.h @@ -1,4 +1,3 @@ - /* * Copyright 2006 The Android Open Source Project * @@ -6,15 +5,11 @@ * found in the LICENSE file. */ - - - // Inspired by Rob Johnson's most excellent QuickDraw GX sample code #ifndef SkCamera_DEFINED #define SkCamera_DEFINED -#include "Sk64.h" #include "SkMatrix.h" class SkCanvas; |