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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 #define SkScalarFastInvert(x) (SK_Scalar1 / (x)) | 132 #define SkScalarFastInvert(x) (SK_Scalar1 / (x)) |
133 /** Returns the square root of the SkScalar | 133 /** Returns the square root of the SkScalar |
134 */ | 134 */ |
135 #define SkScalarSqrt(x) sk_float_sqrt(x) | 135 #define SkScalarSqrt(x) sk_float_sqrt(x) |
136 /** Returns b to the e | 136 /** Returns b to the e |
137 */ | 137 */ |
138 #define SkScalarPow(b, e) sk_float_pow(b, e) | 138 #define SkScalarPow(b, e) sk_float_pow(b, e) |
139 /** Returns the average of two SkScalars (a+b)/2 | 139 /** Returns the average of two SkScalars (a+b)/2 |
140 */ | 140 */ |
141 #define SkScalarAve(a, b) (((a) + (b)) * 0.5f) | 141 #define SkScalarAve(a, b) (((a) + (b)) * 0.5f) |
142 /** Returns the geometric mean of two SkScalars | |
143 */ | |
144 #define SkScalarMean(a, b) sk_float_sqrt((float)(a) * (b)) | |
145 /** Returns one half of the specified SkScalar | 142 /** Returns one half of the specified SkScalar |
146 */ | 143 */ |
147 #define SkScalarHalf(a) ((a) * 0.5f) | 144 #define SkScalarHalf(a) ((a) * 0.5f) |
148 | 145 |
149 #define SK_ScalarSqrt2 1.41421356f | 146 #define SK_ScalarSqrt2 1.41421356f |
150 #define SK_ScalarPI 3.14159265f | 147 #define SK_ScalarPI 3.14159265f |
151 #define SK_ScalarTanPIOver8 0.414213562f | 148 #define SK_ScalarTanPIOver8 0.414213562f |
152 #define SK_ScalarRoot2Over2 0.707106781f | 149 #define SK_ScalarRoot2Over2 0.707106781f |
153 | 150 |
154 #define SkDegreesToRadians(degrees) ((degrees) * (SK_ScalarPI / 180)) | 151 #define SkDegreesToRadians(degrees) ((degrees) * (SK_ScalarPI / 180)) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 SkASSERT(n >= 0); | 233 SkASSERT(n >= 0); |
237 for (int i = 0; i < n; ++i) { | 234 for (int i = 0; i < n; ++i) { |
238 if (a[i] != b[i]) { | 235 if (a[i] != b[i]) { |
239 return false; | 236 return false; |
240 } | 237 } |
241 } | 238 } |
242 return true; | 239 return true; |
243 } | 240 } |
244 | 241 |
245 #endif | 242 #endif |
OLD | NEW |