OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkScalar_DEFINED | 10 #ifndef SkScalar_DEFINED |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 */ | 71 */ |
72 #define SkIntToScalar(n) ((float)(n)) | 72 #define SkIntToScalar(n) ((float)(n)) |
73 /** SkFixedToScalar(n) returns its SkFixed argument as an SkScalar | 73 /** SkFixedToScalar(n) returns its SkFixed argument as an SkScalar |
74 */ | 74 */ |
75 #define SkFixedToScalar(x) SkFixedToFloat(x) | 75 #define SkFixedToScalar(x) SkFixedToFloat(x) |
76 /** SkScalarToFixed(n) returns its SkScalar argument as an SkFixed | 76 /** SkScalarToFixed(n) returns its SkScalar argument as an SkFixed |
77 */ | 77 */ |
78 #define SkScalarToFixed(x) SkFloatToFixed(x) | 78 #define SkScalarToFixed(x) SkFloatToFixed(x) |
79 | 79 |
80 #define SkScalarToFloat(n) (n) | 80 #define SkScalarToFloat(n) (n) |
| 81 #ifndef SK_SCALAR_TO_FLOAT_EXCLUDED |
81 #define SkFloatToScalar(n) (n) | 82 #define SkFloatToScalar(n) (n) |
| 83 #endif |
82 | 84 |
83 #define SkScalarToDouble(n) (double)(n) | 85 #define SkScalarToDouble(n) (double)(n) |
84 #define SkDoubleToScalar(n) (float)(n) | 86 #define SkDoubleToScalar(n) (float)(n) |
85 | 87 |
86 /** SkScalarFraction(x) returns the signed fractional part of the argument | 88 /** SkScalarFraction(x) returns the signed fractional part of the argument |
87 */ | 89 */ |
88 #define SkScalarFraction(x) sk_float_mod(x, 1.0f) | 90 #define SkScalarFraction(x) sk_float_mod(x, 1.0f) |
89 | 91 |
90 #define SkScalarFloorToScalar(x) sk_float_floor(x) | 92 #define SkScalarFloorToScalar(x) sk_float_floor(x) |
91 #define SkScalarCeilToScalar(x) sk_float_ceil(x) | 93 #define SkScalarCeilToScalar(x) sk_float_ceil(x) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 #define SK_ScalarMax SK_FixedMax | 193 #define SK_ScalarMax SK_FixedMax |
192 #define SK_ScalarMin SK_FixedMin | 194 #define SK_ScalarMin SK_FixedMin |
193 #define SK_ScalarNaN SK_FixedNaN | 195 #define SK_ScalarNaN SK_FixedNaN |
194 #define SkScalarIsNaN(x) ((x) == SK_FixedNaN) | 196 #define SkScalarIsNaN(x) ((x) == SK_FixedNaN) |
195 #define SkScalarIsFinite(x) ((x) != SK_FixedNaN) | 197 #define SkScalarIsFinite(x) ((x) != SK_FixedNaN) |
196 | 198 |
197 #define SkIntToScalar(n) SkIntToFixed(n) | 199 #define SkIntToScalar(n) SkIntToFixed(n) |
198 #define SkFixedToScalar(x) (x) | 200 #define SkFixedToScalar(x) (x) |
199 #define SkScalarToFixed(x) (x) | 201 #define SkScalarToFixed(x) (x) |
200 #define SkScalarToFloat(n) SkFixedToFloat(n) | 202 #define SkScalarToFloat(n) SkFixedToFloat(n) |
| 203 #ifndef SK_SCALAR_TO_FLOAT_EXCLUDED |
201 #define SkFloatToScalar(n) SkFloatToFixed(n) | 204 #define SkFloatToScalar(n) SkFloatToFixed(n) |
| 205 #endif |
202 | 206 |
203 #define SkScalarToDouble(n) SkFixedToDouble(n) | 207 #define SkScalarToDouble(n) SkFixedToDouble(n) |
204 #define SkDoubleToScalar(n) SkDoubleToFixed(n) | 208 #define SkDoubleToScalar(n) SkDoubleToFixed(n) |
205 #define SkScalarFraction(x) SkFixedFraction(x) | 209 #define SkScalarFraction(x) SkFixedFraction(x) |
206 | 210 |
207 #define SkScalarFloorToScalar(x) SkFixedFloorToFixed(x) | 211 #define SkScalarFloorToScalar(x) SkFixedFloorToFixed(x) |
208 #define SkScalarCeilToScalar(x) SkFixedCeilToFixed(x) | 212 #define SkScalarCeilToScalar(x) SkFixedCeilToFixed(x) |
209 #define SkScalarRoundToScalar(x) SkFixedRoundToFixed(x) | 213 #define SkScalarRoundToScalar(x) SkFixedRoundToFixed(x) |
210 | 214 |
211 #define SkScalarFloorToInt(x) SkFixedFloorToInt(x) | 215 #define SkScalarFloorToInt(x) SkFixedFloorToInt(x) |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 return false; | 336 return false; |
333 } | 337 } |
334 } | 338 } |
335 return true; | 339 return true; |
336 #else | 340 #else |
337 return 0 == memcmp(a, b, n * sizeof(SkScalar)); | 341 return 0 == memcmp(a, b, n * sizeof(SkScalar)); |
338 #endif | 342 #endif |
339 } | 343 } |
340 | 344 |
341 #endif | 345 #endif |
OLD | NEW |