| 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 SkFixed_DEFINED | 8 #ifndef SkFixed_DEFINED |
| 9 #define SkFixed_DEFINED | 9 #define SkFixed_DEFINED |
| 10 | 10 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 typedef int64_t SkFixed3232; // 32.32 | 145 typedef int64_t SkFixed3232; // 32.32 |
| 146 | 146 |
| 147 #define SkIntToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 32)) | 147 #define SkIntToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 32)) |
| 148 #define SkFixed3232ToInt(x) ((int)((x) >> 32)) | 148 #define SkFixed3232ToInt(x) ((int)((x) >> 32)) |
| 149 #define SkFixedToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 16)) | 149 #define SkFixedToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 16)) |
| 150 #define SkFixed3232ToFixed(x) ((SkFixed)((x) >> 16)) | 150 #define SkFixed3232ToFixed(x) ((SkFixed)((x) >> 16)) |
| 151 #define SkFloatToFixed3232(x) ((SkFixed3232)((x) * (65536.0f * 65536.0f))) | 151 #define SkFloatToFixed3232(x) ((SkFixed3232)((x) * (65536.0f * 65536.0f))) |
| 152 | 152 |
| 153 #define SkScalarToFixed3232(x) SkFloatToFixed3232(x) | 153 #define SkScalarToFixed3232(x) SkFloatToFixed3232(x) |
| 154 | 154 |
| 155 /////////////////////////////////////////////////////////////////////////////// | |
| 156 | |
| 157 // 64bits wide, with a 16bit bias. Useful when accumulating lots of 16.16 so | |
| 158 // we don't overflow along the way | |
| 159 typedef int64_t Sk48Dot16; | |
| 160 | |
| 161 #define Sk48Dot16FloorToInt(x) static_cast<int>((x) >> 16) | |
| 162 | |
| 163 static inline float Sk48Dot16ToScalar(Sk48Dot16 x) { | |
| 164 return static_cast<float>(x * 1.5258789e-5); // x * (1.0f / (1 << 16)) | |
| 165 } | |
| 166 #define SkFloatTo48Dot16(x) (static_cast<Sk48Dot16>((x) * (1 << 16))) | |
| 167 | |
| 168 #define SkScalarTo48Dot16(x) SkFloatTo48Dot16(x) | |
| 169 | |
| 170 #endif | 155 #endif |
| OLD | NEW |