Chromium Code Reviews| 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 #define SkFloatToScalar(n) (n) | |
| 82 | 81 |
| 83 #define SkScalarToDouble(n) (double)(n) | 82 #define SkScalarToDouble(n) (double)(n) |
|
reed1
2013/11/25 18:09:36
Just off hand, I wonder if we need this guy? We ca
| |
| 84 #define SkDoubleToScalar(n) (float)(n) | 83 #define SkDoubleToScalar(n) (float)(n) |
| 85 | 84 |
| 86 /** SkScalarFraction(x) returns the signed fractional part of the argument | 85 /** SkScalarFraction(x) returns the signed fractional part of the argument |
| 87 */ | 86 */ |
| 88 #define SkScalarFraction(x) sk_float_mod(x, 1.0f) | 87 #define SkScalarFraction(x) sk_float_mod(x, 1.0f) |
| 89 | 88 |
| 90 #define SkScalarFloorToScalar(x) sk_float_floor(x) | 89 #define SkScalarFloorToScalar(x) sk_float_floor(x) |
| 91 #define SkScalarCeilToScalar(x) sk_float_ceil(x) | 90 #define SkScalarCeilToScalar(x) sk_float_ceil(x) |
| 92 #define SkScalarRoundToScalar(x) sk_float_floor((x) + 0.5f) | 91 #define SkScalarRoundToScalar(x) sk_float_floor((x) + 0.5f) |
| 93 | 92 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 #define SK_ScalarMax SK_FixedMax | 190 #define SK_ScalarMax SK_FixedMax |
| 192 #define SK_ScalarMin SK_FixedMin | 191 #define SK_ScalarMin SK_FixedMin |
| 193 #define SK_ScalarNaN SK_FixedNaN | 192 #define SK_ScalarNaN SK_FixedNaN |
| 194 #define SkScalarIsNaN(x) ((x) == SK_FixedNaN) | 193 #define SkScalarIsNaN(x) ((x) == SK_FixedNaN) |
| 195 #define SkScalarIsFinite(x) ((x) != SK_FixedNaN) | 194 #define SkScalarIsFinite(x) ((x) != SK_FixedNaN) |
| 196 | 195 |
| 197 #define SkIntToScalar(n) SkIntToFixed(n) | 196 #define SkIntToScalar(n) SkIntToFixed(n) |
| 198 #define SkFixedToScalar(x) (x) | 197 #define SkFixedToScalar(x) (x) |
| 199 #define SkScalarToFixed(x) (x) | 198 #define SkScalarToFixed(x) (x) |
| 200 #define SkScalarToFloat(n) SkFixedToFloat(n) | 199 #define SkScalarToFloat(n) SkFixedToFloat(n) |
| 201 #define SkFloatToScalar(n) SkFloatToFixed(n) | |
| 202 | 200 |
| 203 #define SkScalarToDouble(n) SkFixedToDouble(n) | 201 #define SkScalarToDouble(n) SkFixedToDouble(n) |
| 204 #define SkDoubleToScalar(n) SkDoubleToFixed(n) | 202 #define SkDoubleToScalar(n) SkDoubleToFixed(n) |
| 205 #define SkScalarFraction(x) SkFixedFraction(x) | 203 #define SkScalarFraction(x) SkFixedFraction(x) |
| 206 | 204 |
| 207 #define SkScalarFloorToScalar(x) SkFixedFloorToFixed(x) | 205 #define SkScalarFloorToScalar(x) SkFixedFloorToFixed(x) |
| 208 #define SkScalarCeilToScalar(x) SkFixedCeilToFixed(x) | 206 #define SkScalarCeilToScalar(x) SkFixedCeilToFixed(x) |
| 209 #define SkScalarRoundToScalar(x) SkFixedRoundToFixed(x) | 207 #define SkScalarRoundToScalar(x) SkFixedRoundToFixed(x) |
| 210 | 208 |
| 211 #define SkScalarFloorToInt(x) SkFixedFloorToInt(x) | 209 #define SkScalarFloorToInt(x) SkFixedFloorToInt(x) |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 return false; | 330 return false; |
| 333 } | 331 } |
| 334 } | 332 } |
| 335 return true; | 333 return true; |
| 336 #else | 334 #else |
| 337 return 0 == memcmp(a, b, n * sizeof(SkScalar)); | 335 return 0 == memcmp(a, b, n * sizeof(SkScalar)); |
| 338 #endif | 336 #endif |
| 339 } | 337 } |
| 340 | 338 |
| 341 #endif | 339 #endif |
| OLD | NEW |