OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkFixed_DEFINED | 8 #ifndef SkFixed_DEFINED |
9 #define SkFixed_DEFINED | 9 #define SkFixed_DEFINED |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 #define SkFixedCeilToFixed(x) (((x) + SK_Fixed1 - 1) & 0xFFFF0000) | 75 #define SkFixedCeilToFixed(x) (((x) + SK_Fixed1 - 1) & 0xFFFF0000) |
76 #define SkFixedFloorToFixed(x) ((x) & 0xFFFF0000) | 76 #define SkFixedFloorToFixed(x) ((x) & 0xFFFF0000) |
77 | 77 |
78 #define SkFixedAbs(x) SkAbs32(x) | 78 #define SkFixedAbs(x) SkAbs32(x) |
79 #define SkFixedAve(a, b) (((a) + (b)) >> 1) | 79 #define SkFixedAve(a, b) (((a) + (b)) >> 1) |
80 | 80 |
81 SkFixed SkFixedMul_portable(SkFixed, SkFixed); | 81 SkFixed SkFixedMul_portable(SkFixed, SkFixed); |
82 | 82 |
83 #define SkFixedDiv(numer, denom) SkDivBits(numer, denom, 16) | 83 #define SkFixedDiv(numer, denom) SkDivBits(numer, denom, 16) |
84 | 84 |
85 /////////////////////////////////////////////////////////////////////////////// | |
86 // TODO: move fixed sin/cos into SkCosineMapper, as that is the only caller | |
87 // or rewrite SkCosineMapper to not use it at all | |
88 | |
89 SkFixed SkFixedSinCos(SkFixed radians, SkFixed* cosValueOrNull); | |
90 #define SkFixedSin(radians) SkFixedSinCos(radians, NULL) | |
91 static inline SkFixed SkFixedCos(SkFixed radians) { | |
92 SkFixed cosValue; | |
93 (void)SkFixedSinCos(radians, &cosValue); | |
94 return cosValue; | |
95 } | |
96 | |
97 ////////////////////////////////////////////////////////////////////////////////
////////////////////// | 85 ////////////////////////////////////////////////////////////////////////////////
////////////////////// |
98 // Now look for ASM overrides for our portable versions (should consider putting
this in its own file) | 86 // Now look for ASM overrides for our portable versions (should consider putting
this in its own file) |
99 | 87 |
100 #ifdef SkLONGLONG | 88 #ifdef SkLONGLONG |
101 inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b) | 89 inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b) |
102 { | 90 { |
103 return (SkFixed)((int64_t)a * b >> 16); | 91 return (SkFixed)((int64_t)a * b >> 16); |
104 } | 92 } |
105 #define SkFixedMul(a,b) SkFixedMul_longlong(a,b) | 93 #define SkFixedMul(a,b) SkFixedMul_longlong(a,b) |
106 #endif | 94 #endif |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 144 |
157 #define SkIntToFixed48(x) ((SkFixed48)(x) << 48) | 145 #define SkIntToFixed48(x) ((SkFixed48)(x) << 48) |
158 #define SkFixed48ToInt(x) ((int)((x) >> 48)) | 146 #define SkFixed48ToInt(x) ((int)((x) >> 48)) |
159 #define SkFixedToFixed48(x) ((SkFixed48)(x) << 32) | 147 #define SkFixedToFixed48(x) ((SkFixed48)(x) << 32) |
160 #define SkFixed48ToFixed(x) ((SkFixed)((x) >> 32)) | 148 #define SkFixed48ToFixed(x) ((SkFixed)((x) >> 32)) |
161 #define SkFloatToFixed48(x) ((SkFixed48)((x) * (65536.0f * 65536.0f * 65536.
0f))) | 149 #define SkFloatToFixed48(x) ((SkFixed48)((x) * (65536.0f * 65536.0f * 65536.
0f))) |
162 | 150 |
163 #define SkScalarToFixed48(x) SkFloatToFixed48(x) | 151 #define SkScalarToFixed48(x) SkFloatToFixed48(x) |
164 | 152 |
165 #endif | 153 #endif |
OLD | NEW |