| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkFloat_DEFINED | 10 #ifndef SkFloat_DEFINED |
| 11 #define SkFloat_DEFINED | 11 #define SkFloat_DEFINED |
| 12 | 12 |
| 13 #include "SkFixed.h" | 13 #include "SkFixed.h" |
| 14 | 14 |
| 15 class SkFloat { | 15 class SkFloat { |
| 16 public: | 16 public: |
| 17 SkFloat() {} | 17 SkFloat() {} |
| 18 | 18 |
| 19 void setZero() { fPacked = 0; } | 19 void setZero() { fPacked = 0; } |
| 20 // void setShift(int value, int shift) { fPacked = SetShift(value, shift); } | 20 // void setShift(int value, int shift) { fPacked = SetShift(value, shift); } |
| 21 void setInt(int value) { fPacked = SetShift(value, 0); } | 21 void setInt(int value) { fPacked = SetShift(value, 0); } |
| 22 void setFixed(SkFixed value) { fPacked = SetShift(value, -16); } | 22 void setFixed(SkFixed value) { fPacked = SetShift(value, -16); } |
| 23 void setFract(SkFract value) { fPacked = SetShift(value, -30); } | |
| 24 | 23 |
| 25 // int getShift(int shift) const { return GetShift(fPacked, shift); } | 24 // int getShift(int shift) const { return GetShift(fPacked, shift); } |
| 26 int getInt() const { return GetShift(fPacked, 0); } | 25 int getInt() const { return GetShift(fPacked, 0); } |
| 27 SkFixed getFixed() const { return GetShift(fPacked, -16); } | 26 SkFixed getFixed() const { return GetShift(fPacked, -16); } |
| 28 SkFract getFract() const { return GetShift(fPacked, -30); } | |
| 29 | 27 |
| 30 void abs() { fPacked = Abs(fPacked); } | 28 void abs() { fPacked = Abs(fPacked); } |
| 31 void negate() { fPacked = Neg(fPacked); } | 29 void negate() { fPacked = Neg(fPacked); } |
| 32 | 30 |
| 33 void shiftLeft(int bits) { fPacked = Shift(fPacked, bits); } | 31 void shiftLeft(int bits) { fPacked = Shift(fPacked, bits); } |
| 34 void setShiftLeft(const SkFloat& a, int bits) { fPacked = Shift(a.fPacked
, bits); } | 32 void setShiftLeft(const SkFloat& a, int bits) { fPacked = Shift(a.fPacked
, bits); } |
| 35 | 33 |
| 36 void shiftRight(int bits) { fPacked = Shift(fPacked, -bits); } | 34 void shiftRight(int bits) { fPacked = Shift(fPacked, -bits); } |
| 37 void setShiftRight(const SkFloat& a, int bits) { fPacked = Shift(a.fPacke
d, -bits); } | 35 void setShiftRight(const SkFloat& a, int bits) { fPacked = Shift(a.fPacke
d, -bits); } |
| 38 | 36 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 static int32_t MulInt(int32_t, int); | 98 static int32_t MulInt(int32_t, int); |
| 101 static int32_t Div(int32_t, int32_t); | 99 static int32_t Div(int32_t, int32_t); |
| 102 static int32_t DivInt(int32_t, int); | 100 static int32_t DivInt(int32_t, int); |
| 103 static int32_t Invert(int32_t); | 101 static int32_t Invert(int32_t); |
| 104 static int32_t Sqrt(int32_t); | 102 static int32_t Sqrt(int32_t); |
| 105 static int32_t CubeRoot(int32_t); | 103 static int32_t CubeRoot(int32_t); |
| 106 static int Cmp(int32_t, int32_t); | 104 static int Cmp(int32_t, int32_t); |
| 107 }; | 105 }; |
| 108 | 106 |
| 109 #endif | 107 #endif |
| OLD | NEW |