diff options
author | 2012-11-13 20:12:00 +0000 | |
---|---|---|
committer | 2012-11-13 20:12:00 +0000 | |
commit | 5596a69e9f7884e3042bceba071c468dee52aa7f (patch) | |
tree | f2c0dea0b4b216f82a8010ed7c29376f58c8e6c8 | |
parent | a09e8838f2534d42046338752482d6759f6c649d (diff) |
Add support for SK_MSCALAR_IS_FLOAT
The default is SK_MSCALAR_IS_FLOAT. You'll have to explicitly define SK_MSCALAR_IS_DOUBLE if that's what you want.
BUG=None
Review URL: https://codereview.appspot.com/6843049
git-svn-id: http://skia.googlecode.com/svn/trunk@6403 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | include/core/SkPostConfig.h | 6 | ||||
-rw-r--r-- | include/utils/SkMatrix44.h | 4 | ||||
-rw-r--r-- | src/utils/SkMatrix44.cpp | 4 |
3 files changed, 10 insertions, 4 deletions
diff --git a/include/core/SkPostConfig.h b/include/core/SkPostConfig.h index cbfe9b126a..9a5c54a171 100644 --- a/include/core/SkPostConfig.h +++ b/include/core/SkPostConfig.h @@ -30,6 +30,12 @@ #define SK_SCALAR_IS_FLOAT #endif +#if defined(SK_MSCALAR_IS_DOUBLE) && defined(SK_MSCALAR_IS_FLOAT) + #error "cannot define both SK_MSCALAR_IS_DOUBLE and SK_MSCALAR_IS_FLOAT" +#elif !defined(SK_MSCALAR_IS_DOUBLE) && !defined(SK_MSCALAR_IS_FLOAT) + #define SK_MSCALAR_IS_FLOAT +#endif + #if defined(SK_CPU_LENDIAN) && defined(SK_CPU_BENDIAN) #error "cannot define both SK_CPU_LENDIAN and SK_CPU_BENDIAN" #elif !defined(SK_CPU_LENDIAN) && !defined(SK_CPU_BENDIAN) diff --git a/include/utils/SkMatrix44.h b/include/utils/SkMatrix44.h index 8c6d0350dd..97faf783f4 100644 --- a/include/utils/SkMatrix44.h +++ b/include/utils/SkMatrix44.h @@ -29,7 +29,7 @@ return x; } static const SkMScalar SK_MScalarPI = 3.141592653589793; -#else +#elif defined SK_MSCALAR_IS_FLOAT typedef float SkMScalar; static inline float SkFloatToMScalar(float x) { return x; @@ -202,7 +202,7 @@ public: #ifdef SK_MSCALAR_IS_DOUBLE void mapMScalars(const SkMScalar src[4], SkMScalar dst[4]) const; -#else +#elif defined SK_MSCALAR_IS_FLOAT void mapMScalars(const SkMScalar src[4], SkMScalar dst[4]) const { this->mapScalars(src, dst); } diff --git a/src/utils/SkMatrix44.cpp b/src/utils/SkMatrix44.cpp index 4fe82deaf6..abef0b33bb 100644 --- a/src/utils/SkMatrix44.cpp +++ b/src/utils/SkMatrix44.cpp @@ -42,7 +42,7 @@ void SkMatrix44::asColMajorf(float dst[]) const { for (int i = 0; i < 16; ++i) { dst[i] = SkMScalarToFloat(src[i]); } -#else +#elif defined SK_MSCALAR_IS_FLOAT memcpy(dst, src, 16 * sizeof(float)); #endif } @@ -51,7 +51,7 @@ void SkMatrix44::asColMajord(double dst[]) const { const SkMScalar* src = &fMat[0][0]; #ifdef SK_MSCALAR_IS_DOUBLE memcpy(dst, src, 16 * sizeof(double)); -#else +#elif defined SK_MSCALAR_IS_FLOAT for (int i = 0; i < 16; ++i) { dst[i] = SkMScalarToDouble(src[i]); } |