| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 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 #include "SkDisplayMath.h" | 10 #include "SkDisplayMath.h" |
| 11 | 11 |
| 12 enum SkDisplayMath_Properties { | 12 enum SkDisplayMath_Properties { |
| 13 SK_PROPERTY(E), | 13 SK_PROPERTY(E), |
| 14 SK_PROPERTY(LN10), | 14 SK_PROPERTY(LN10), |
| 15 SK_PROPERTY(LN2), | 15 SK_PROPERTY(LN2), |
| 16 SK_PROPERTY(LOG10E), | 16 SK_PROPERTY(LOG10E), |
| 17 SK_PROPERTY(LOG2E), | 17 SK_PROPERTY(LOG2E), |
| 18 SK_PROPERTY(PI), | 18 SK_PROPERTY(PI), |
| 19 SK_PROPERTY(SQRT1_2), | 19 SK_PROPERTY(SQRT1_2), |
| 20 SK_PROPERTY(SQRT2) | 20 SK_PROPERTY(SQRT2) |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 const SkScalar SkDisplayMath::gConstants[] = { | 23 const SkScalar SkDisplayMath::gConstants[] = { |
| 24 #ifdef SK_SCALAR_IS_FLOAT | |
| 25 2.718281828f, // E | 24 2.718281828f, // E |
| 26 2.302585093f, // LN10 | 25 2.302585093f, // LN10 |
| 27 0.693147181f, // LN2 | 26 0.693147181f, // LN2 |
| 28 0.434294482f, // LOG10E | 27 0.434294482f, // LOG10E |
| 29 1.442695041f, // LOG2E | 28 1.442695041f, // LOG2E |
| 30 3.141592654f, // PI | 29 3.141592654f, // PI |
| 31 0.707106781f, // SQRT1_2 | 30 0.707106781f, // SQRT1_2 |
| 32 1.414213562f // SQRT2 | 31 1.414213562f // SQRT2 |
| 33 #else | |
| 34 0x2B7E1, // E | |
| 35 0x24D76, // LN10 | |
| 36 0xB172, // LN2 | |
| 37 0x6F2E, // LOG10E | |
| 38 0x17154, // LOG2E | |
| 39 0x3243F, // PI | |
| 40 0xB505, // SQRT1_2 | |
| 41 0x16A0A // SQRT2 | |
| 42 #endif | |
| 43 }; | 32 }; |
| 44 | 33 |
| 45 enum SkDisplayMath_Functions { | 34 enum SkDisplayMath_Functions { |
| 46 SK_FUNCTION(abs), | 35 SK_FUNCTION(abs), |
| 47 SK_FUNCTION(acos), | 36 SK_FUNCTION(acos), |
| 48 SK_FUNCTION(asin), | 37 SK_FUNCTION(asin), |
| 49 SK_FUNCTION(atan), | 38 SK_FUNCTION(atan), |
| 50 SK_FUNCTION(atan2), | 39 SK_FUNCTION(atan2), |
| 51 SK_FUNCTION(ceil), | 40 SK_FUNCTION(ceil), |
| 52 SK_FUNCTION(cos), | 41 SK_FUNCTION(cos), |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 220 |
| 232 bool SkDisplayMath::getProperty(int index, SkScriptValue* value) const { | 221 bool SkDisplayMath::getProperty(int index, SkScriptValue* value) const { |
| 233 if ((unsigned)index < SK_ARRAY_COUNT(gConstants)) { | 222 if ((unsigned)index < SK_ARRAY_COUNT(gConstants)) { |
| 234 value->fOperand.fScalar = gConstants[index]; | 223 value->fOperand.fScalar = gConstants[index]; |
| 235 value->fType = SkType_Float; | 224 value->fType = SkType_Float; |
| 236 return true; | 225 return true; |
| 237 } | 226 } |
| 238 SkASSERT(0); | 227 SkASSERT(0); |
| 239 return false; | 228 return false; |
| 240 } | 229 } |
| OLD | NEW |