| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 SkToS32(SkTPin<int64_t>((SkLeftShift((int64_t)(numer), 16) / (denom)), SK_Mi
nS32, SK_MaxS32)) | 81 SkToS32(SkTPin<int64_t>((SkLeftShift((int64_t)(numer), 16) / (denom)), SK_Mi
nS32, SK_MaxS32)) |
| 82 | 82 |
| 83 ////////////////////////////////////////////////////////////////////////////////
////////////////////// | 83 ////////////////////////////////////////////////////////////////////////////////
////////////////////// |
| 84 // Now look for ASM overrides for our portable versions (should consider putting
this in its own file) | 84 // Now look for ASM overrides for our portable versions (should consider putting
this in its own file) |
| 85 | 85 |
| 86 inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b) { | 86 inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b) { |
| 87 return (SkFixed)((int64_t)a * b >> 16); | 87 return (SkFixed)((int64_t)a * b >> 16); |
| 88 } | 88 } |
| 89 #define SkFixedMul(a,b) SkFixedMul_longlong(a,b) | 89 #define SkFixedMul(a,b) SkFixedMul_longlong(a,b) |
| 90 | 90 |
| 91 inline SkFixed SkFixedMul_lowprec(SkFixed a, SkFixed b) { |
| 92 return (a >> 8) * (b >> 8); |
| 93 } |
| 94 |
| 91 | 95 |
| 92 #if defined(SK_CPU_ARM32) | 96 #if defined(SK_CPU_ARM32) |
| 93 /* This guy does not handle NaN or other obscurities, but is faster than | 97 /* This guy does not handle NaN or other obscurities, but is faster than |
| 94 than (int)(x*65536). When built on Android with -Os, needs forcing | 98 than (int)(x*65536). When built on Android with -Os, needs forcing |
| 95 to inline or we lose the speed benefit. | 99 to inline or we lose the speed benefit. |
| 96 */ | 100 */ |
| 97 SK_ALWAYS_INLINE SkFixed SkFloatToFixed_arm(float x) | 101 SK_ALWAYS_INLINE SkFixed SkFloatToFixed_arm(float x) |
| 98 { | 102 { |
| 99 int32_t y, z; | 103 int32_t y, z; |
| 100 asm("movs %1, %3, lsl #1 \n" | 104 asm("movs %1, %3, lsl #1 \n" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 154 |
| 151 #define SkIntToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 32)) | 155 #define SkIntToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 32)) |
| 152 #define SkFixed3232ToInt(x) ((int)((x) >> 32)) | 156 #define SkFixed3232ToInt(x) ((int)((x) >> 32)) |
| 153 #define SkFixedToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 16)) | 157 #define SkFixedToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 16)) |
| 154 #define SkFixed3232ToFixed(x) ((SkFixed)((x) >> 16)) | 158 #define SkFixed3232ToFixed(x) ((SkFixed)((x) >> 16)) |
| 155 #define SkFloatToFixed3232(x) ((SkFixed3232)((x) * (65536.0f * 65536.0f))) | 159 #define SkFloatToFixed3232(x) ((SkFixed3232)((x) * (65536.0f * 65536.0f))) |
| 156 | 160 |
| 157 #define SkScalarToFixed3232(x) SkFloatToFixed3232(x) | 161 #define SkScalarToFixed3232(x) SkFloatToFixed3232(x) |
| 158 | 162 |
| 159 #endif | 163 #endif |
| OLD | NEW |