| 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 |
| 11 #include "SkScalar.h" |
| 11 #include "SkTypes.h" | 12 #include "SkTypes.h" |
| 12 | 13 |
| 13 /** \file SkFixed.h | 14 /** \file SkFixed.h |
| 14 | 15 |
| 15 Types and macros for 16.16 fixed point | 16 Types and macros for 16.16 fixed point |
| 16 */ | 17 */ |
| 17 | 18 |
| 18 /** 32 bit signed integer used to represent fractions values with 16 bits to the
right of the decimal point | 19 /** 32 bit signed integer used to represent fractions values with 16 bits to the
right of the decimal point |
| 19 */ | 20 */ |
| 20 typedef int32_t SkFixed; | 21 typedef int32_t SkFixed; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 } | 136 } |
| 136 #undef SkFixedMul | 137 #undef SkFixedMul |
| 137 #define SkFixedMul(x, y) SkFixedMul_arm(x, y) | 138 #define SkFixedMul(x, y) SkFixedMul_arm(x, y) |
| 138 | 139 |
| 139 #undef SkFloatToFixed | 140 #undef SkFloatToFixed |
| 140 #define SkFloatToFixed(x) SkFloatToFixed_arm(x) | 141 #define SkFloatToFixed(x) SkFloatToFixed_arm(x) |
| 141 #endif | 142 #endif |
| 142 | 143 |
| 143 /////////////////////////////////////////////////////////////////////////////// | 144 /////////////////////////////////////////////////////////////////////////////// |
| 144 | 145 |
| 146 #if SK_SCALAR_IS_FLOAT |
| 147 |
| 148 #define SkFixedToScalar(x) SkFixedToFloat(x) |
| 149 #define SkScalarToFixed(x) SkFloatToFixed(x) |
| 150 |
| 151 #else // SK_SCALAR_IS_DOUBLE |
| 152 |
| 153 #define SkFixedToScalar(x) SkFixedToDouble(x) |
| 154 #define SkScalarToFixed(x) SkDoubleToFixed(x) |
| 155 |
| 156 #endif |
| 157 |
| 158 /////////////////////////////////////////////////////////////////////////////// |
| 159 |
| 145 typedef int64_t SkFixed3232; // 32.32 | 160 typedef int64_t SkFixed3232; // 32.32 |
| 146 | 161 |
| 147 #define SkIntToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 32)) | 162 #define SkIntToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 32)) |
| 148 #define SkFixed3232ToInt(x) ((int)((x) >> 32)) | 163 #define SkFixed3232ToInt(x) ((int)((x) >> 32)) |
| 149 #define SkFixedToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 16)) | 164 #define SkFixedToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 16)) |
| 150 #define SkFixed3232ToFixed(x) ((SkFixed)((x) >> 16)) | 165 #define SkFixed3232ToFixed(x) ((SkFixed)((x) >> 16)) |
| 151 #define SkFloatToFixed3232(x) ((SkFixed3232)((x) * (65536.0f * 65536.0f))) | 166 #define SkFloatToFixed3232(x) ((SkFixed3232)((x) * (65536.0f * 65536.0f))) |
| 152 | 167 |
| 153 #define SkScalarToFixed3232(x) SkFloatToFixed3232(x) | 168 #define SkScalarToFixed3232(x) SkFloatToFixed3232(x) |
| 154 | 169 |
| 155 #endif | 170 #endif |
| OLD | NEW |