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 SkFDot6_DEFINED | 10 #ifndef SkFDot6_DEFINED |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #define SkFixedToFDot6(x) ((x) >> 10) | 56 #define SkFixedToFDot6(x) ((x) >> 10) |
57 | 57 |
58 inline SkFixed SkFDot6ToFixed(SkFDot6 x) { | 58 inline SkFixed SkFDot6ToFixed(SkFDot6 x) { |
59 SkASSERT((SkLeftShift(x, 10) >> 10) == x); | 59 SkASSERT((SkLeftShift(x, 10) >> 10) == x); |
60 | 60 |
61 return SkLeftShift(x, 10); | 61 return SkLeftShift(x, 10); |
62 } | 62 } |
63 | 63 |
64 #define SkScalarToFDot6(x) (SkFDot6)((x) * 64) | 64 #define SkScalarToFDot6(x) (SkFDot6)((x) * 64) |
65 #define SkFDot6ToScalar(x) ((SkScalar)(x) * 0.015625f) | 65 #define SkFDot6ToScalar(x) ((SkScalar)(x) * 0.015625f) |
| 66 #define SkFDot6ToFloat SkFDot6ToScalar |
66 | 67 |
67 inline SkFixed SkFDot6Div(SkFDot6 a, SkFDot6 b) { | 68 inline SkFixed SkFDot6Div(SkFDot6 a, SkFDot6 b) { |
68 SkASSERT(b != 0); | 69 SkASSERT(b != 0); |
69 | 70 |
70 if (a == (int16_t)a) { | 71 if (a == (int16_t)a) { |
71 return SkLeftShift(a, 16) / b; | 72 return SkLeftShift(a, 16) / b; |
72 } else { | 73 } else { |
73 return SkFixedDiv(a, b); | 74 return SkFixedDiv(a, b); |
74 } | 75 } |
75 } | 76 } |
76 | 77 |
77 #endif | 78 #endif |
OLD | NEW |