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 SkScalar_DEFINED | 8 #ifndef SkScalar_DEFINED |
9 #define SkScalar_DEFINED | 9 #define SkScalar_DEFINED |
10 | 10 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 static inline SkScalar SkScalarPin(SkScalar x, SkScalar min, SkScalar max) { | 177 static inline SkScalar SkScalarPin(SkScalar x, SkScalar min, SkScalar max) { |
178 return SkTPin(x, min, max); | 178 return SkTPin(x, min, max); |
179 } | 179 } |
180 | 180 |
181 SkScalar SkScalarSinCos(SkScalar radians, SkScalar* cosValue); | 181 SkScalar SkScalarSinCos(SkScalar radians, SkScalar* cosValue); |
182 | 182 |
183 static inline SkScalar SkScalarSquare(SkScalar x) { return x * x; } | 183 static inline SkScalar SkScalarSquare(SkScalar x) { return x * x; } |
184 | 184 |
185 #define SkScalarMul(a, b) ((SkScalar)(a) * (b)) | 185 #define SkScalarMul(a, b) ((SkScalar)(a) * (b)) |
186 #define SkScalarMulAdd(a, b, c) ((SkScalar)(a) * (b) + (c)) | 186 #define SkScalarMulAdd(a, b, c) ((SkScalar)(a) * (b) + (c)) |
187 #ifdef SK_SUPPORT_LEGACY_SCALAR_DIV | 187 #define SkScalarDiv(a, b) ((SkScalar)(a) / (b)) |
188 #define SkScalarDiv(a, b) ((SkScalar)(a) / (b)) | |
189 #endif | |
190 #define SkScalarMulDiv(a, b, c) ((SkScalar)(a) * (b) / (c)) | 188 #define SkScalarMulDiv(a, b, c) ((SkScalar)(a) * (b) / (c)) |
191 #define SkScalarInvert(x) (SK_Scalar1 / (x)) | 189 #define SkScalarInvert(x) (SK_Scalar1 / (x)) |
192 #define SkScalarFastInvert(x) (SK_Scalar1 / (x)) | 190 #define SkScalarFastInvert(x) (SK_Scalar1 / (x)) |
193 #define SkScalarAve(a, b) (((a) + (b)) * SK_ScalarHalf) | 191 #define SkScalarAve(a, b) (((a) + (b)) * SK_ScalarHalf) |
194 #define SkScalarHalf(a) ((a) * SK_ScalarHalf) | 192 #define SkScalarHalf(a) ((a) * SK_ScalarHalf) |
195 | 193 |
196 #define SkDegreesToRadians(degrees) ((degrees) * (SK_ScalarPI / 180)) | 194 #define SkDegreesToRadians(degrees) ((degrees) * (SK_ScalarPI / 180)) |
197 #define SkRadiansToDegrees(radians) ((radians) * (180 / SK_ScalarPI)) | 195 #define SkRadiansToDegrees(radians) ((radians) * (180 / SK_ScalarPI)) |
198 | 196 |
199 static inline SkScalar SkMaxScalar(SkScalar a, SkScalar b) { return a > b ? a :
b; } | 197 static inline SkScalar SkMaxScalar(SkScalar a, SkScalar b) { return a > b ? a :
b; } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 SkASSERT(n >= 0); | 261 SkASSERT(n >= 0); |
264 for (int i = 0; i < n; ++i) { | 262 for (int i = 0; i < n; ++i) { |
265 if (a[i] != b[i]) { | 263 if (a[i] != b[i]) { |
266 return false; | 264 return false; |
267 } | 265 } |
268 } | 266 } |
269 return true; | 267 return true; |
270 } | 268 } |
271 | 269 |
272 #endif | 270 #endif |
OLD | NEW |