| 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 | 8 |
| 9 #ifndef SkFDot6_DEFINED | 9 #ifndef SkFDot6_DEFINED |
| 10 #define SkFDot6_DEFINED | 10 #define SkFDot6_DEFINED |
| 11 | 11 |
| 12 #include "SkFixed.h" |
| 12 #include "SkScalar.h" | 13 #include "SkScalar.h" |
| 13 #include "SkMath.h" | 14 #include "SkMath.h" |
| 14 | 15 |
| 15 typedef int32_t SkFDot6; | 16 typedef int32_t SkFDot6; |
| 16 | 17 |
| 17 /* This uses the magic number approach suggested here: | 18 /* This uses the magic number approach suggested here: |
| 18 * http://stereopsis.com/sree/fpu2006.html and used in | 19 * http://stereopsis.com/sree/fpu2006.html and used in |
| 19 * _cairo_fixed_from_double. It does banker's rounding | 20 * _cairo_fixed_from_double. It does banker's rounding |
| 20 * (i.e. round to nearest even) | 21 * (i.e. round to nearest even) |
| 21 */ | 22 */ |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |