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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 typedef int64_t SkFixed3232; // 32.32 | 143 typedef int64_t SkFixed3232; // 32.32 |
144 | 144 |
145 #define SkIntToFixed3232(x) ((SkFixed3232)(x) << 32) | 145 #define SkIntToFixed3232(x) ((SkFixed3232)(x) << 32) |
146 #define SkFixed3232ToInt(x) ((int)((x) >> 32)) | 146 #define SkFixed3232ToInt(x) ((int)((x) >> 32)) |
147 #define SkFixedToFixed3232(x) ((SkFixed3232)(x) << 16) | 147 #define SkFixedToFixed3232(x) ((SkFixed3232)(x) << 16) |
148 #define SkFixed3232ToFixed(x) ((SkFixed)((x) >> 16)) | 148 #define SkFixed3232ToFixed(x) ((SkFixed)((x) >> 16)) |
149 #define SkFloatToFixed3232(x) ((SkFixed3232)((x) * (65536.0f * 65536.0f))) | 149 #define SkFloatToFixed3232(x) ((SkFixed3232)((x) * (65536.0f * 65536.0f))) |
150 | 150 |
151 #define SkScalarToFixed3232(x) SkFloatToFixed3232(x) | 151 #define SkScalarToFixed3232(x) SkFloatToFixed3232(x) |
152 | 152 |
153 /////////////////////////////////////////////////////////////////////////////// | |
154 | |
155 // 64bits wide, with a 16bit bias. Useful when accumulating lots of 16.16 so | |
156 // we don't overflow along the way | |
157 typedef int64_t Sk48Dot16; | |
mtklein
2015/03/05 21:00:03
Let's harmonize the names of SkFixed3232 and Sk48D
bungeman-skia
2015/03/05 21:17:56
As seen here, I pulled Sk48Dot16 out of SkPaint be
| |
158 | |
159 static inline float Sk48Dot16ToScalar(Sk48Dot16 x) { | |
160 return (float) (x * 1.5258789e-5); // x * (1 / 65536.0f) | |
161 } | |
162 #define SkFloatTo48Dot16(x) ((Sk48Dot16)((x) * SK_Fixed1)) | |
reed1
2015/03/09 16:33:56
I know the value is correct, but it might read cle
bungeman-skia
2015/03/09 17:49:12
Made things line up in a more sane way.
| |
163 | |
164 #define SkScalarTo48Dot16(x) SkFloatTo48Dot16(x) | |
165 | |
153 #endif | 166 #endif |
OLD | NEW |