1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/* 3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project 4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * 5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be 6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file. 7ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com */ 8ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayMath.h" 118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comenum SkDisplayMath_Properties { 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_PROPERTY(E), 148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_PROPERTY(LN10), 158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_PROPERTY(LN2), 168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_PROPERTY(LOG10E), 178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_PROPERTY(LOG2E), 188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_PROPERTY(PI), 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_PROPERTY(SQRT1_2), 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_PROPERTY(SQRT2) 218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comconst SkScalar SkDisplayMath::gConstants[] = { 248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 2.718281828f, // E 258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 2.302585093f, // LN10 268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 0.693147181f, // LN2 278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 0.434294482f, // LOG10E 288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1.442695041f, // LOG2E 298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 3.141592654f, // PI 308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 0.707106781f, // SQRT1_2 31d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com 1.414213562f // SQRT2 328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comenum SkDisplayMath_Functions { 358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(abs), 368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(acos), 378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(asin), 388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(atan), 398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(atan2), 408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(ceil), 418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(cos), 428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(exp), 438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(floor), 448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(log), 458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(max), 468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(min), 478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(pow), 488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(random), 498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(round), 508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(sin), 518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(sqrt), 528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_FUNCTION(tan) 538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comconst SkFunctionParamType SkDisplayMath::fFunctionParameters[] = { 568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // abs 578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // acos 598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // asin 618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // atan 638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // atan2 658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, 668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // ceil 688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // cos 708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // exp 728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // floor 748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // log 768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Array, // max 788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Array, // min 808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // pow 828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, 838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // random 858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // round 878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // sin 898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // sqrt 918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0, 928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) SkType_Float, // tan 938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (SkFunctionParamType) 0 948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if SK_USE_CONDENSED_INFO == 0 978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comconst SkMemberInfo SkDisplayMath::fInfo[] = { 998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_PROPERTY(E, Float), 1008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_PROPERTY(LN10, Float), 1018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_PROPERTY(LN2, Float), 1028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_PROPERTY(LOG10E, Float), 1038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_PROPERTY(LOG2E, Float), 1048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_PROPERTY(PI, Float), 1058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_PROPERTY(SQRT1_2, Float), 1068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_PROPERTY(SQRT2, Float), 1078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(abs, Float), 1088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(acos, Float), 1098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(asin, Float), 1108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(atan, Float), 1118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(atan2, Float), 1128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(ceil, Float), 1138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(cos, Float), 1148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(exp, Float), 1158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(floor, Float), 1168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(log, Float), 1178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(max, Float), 1188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(min, Float), 1198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(pow, Float), 1208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(random, Float), 1218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(round, Float), 1228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(sin, Float), 1238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(sqrt, Float), 1248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SK_MEMBER_FUNCTION(tan, Float) 1258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 1268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comDEFINE_GET_MEMBER(SkDisplayMath); 1308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 131d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.comvoid SkDisplayMath::executeFunction(SkDisplayable* target, int index, 1328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type, 1338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkScriptValue* scriptValue) { 1348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (scriptValue == NULL) 1358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return; 1368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkASSERT(target == this); 1378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkScriptValue* array = parameters.begin(); 1388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkScriptValue* end = parameters.end(); 1398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkScalar input = parameters[0].fOperand.fScalar; 1408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkScalar scalarResult; 1418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com switch (index) { 1428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(abs): 143d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com scalarResult = SkScalarAbs(input); 1448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(acos): 1468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SkScalarACos(input); 1478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(asin): 1498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SkScalarASin(input); 1508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(atan): 1528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SkScalarATan2(input, SK_Scalar1); 1538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(atan2): 1558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SkScalarATan2(input, parameters[1].fOperand.fScalar); 1568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(ceil): 158e1ca705cac4b946993f6cbf798e2a0ba27e739f3reed@google.com scalarResult = SkScalarCeilToScalar(input); 1598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(cos): 1618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SkScalarCos(input); 1628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(exp): 1648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SkScalarExp(input); 1658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(floor): 167e1ca705cac4b946993f6cbf798e2a0ba27e739f3reed@google.com scalarResult = SkScalarFloorToScalar(input); 1688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(log): 1708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SkScalarLog(input); 1718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(max): 1738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = -SK_ScalarMax; 1748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com while (array < end) { 1758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SkMaxScalar(scalarResult, array->fOperand.fScalar); 1768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com array++; 1778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(min): 1808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SK_ScalarMax; 1818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com while (array < end) { 1828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SkMinScalar(scalarResult, array->fOperand.fScalar); 1838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com array++; 1848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(pow): 1878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // not the greatest -- but use x^y = e^(y * ln(x)) 1888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SkScalarLog(input); 1898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SkScalarMul(parameters[1].fOperand.fScalar, scalarResult); 1908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SkScalarExp(scalarResult); 1918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(random): 1938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = fRandom.nextUScalar1(); 1948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(round): 196e1ca705cac4b946993f6cbf798e2a0ba27e739f3reed@google.com scalarResult = SkScalarRoundToScalar(input); 1978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(sin): 1998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SkScalarSin(input); 2008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 2018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(sqrt): { 2028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkASSERT(parameters.count() == 1); 2038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkASSERT(type == SkType_Float); 204d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com scalarResult = SkScalarSqrt(input); 2058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } break; 2068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SK_FUNCTION(tan): 2078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SkScalarTan(input); 2088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 2098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com default: 2108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkASSERT(0); 2118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scalarResult = SK_ScalarNaN; 2128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 2138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scriptValue->fOperand.fScalar = scalarResult; 2148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scriptValue->fType = SkType_Float; 2158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 2168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 2178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comconst SkFunctionParamType* SkDisplayMath::getFunctionsParameters() { 2188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return fFunctionParameters; 2198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 2208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 2218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.combool SkDisplayMath::getProperty(int index, SkScriptValue* value) const { 2228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if ((unsigned)index < SK_ARRAY_COUNT(gConstants)) { 2238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com value->fOperand.fScalar = gConstants[index]; 2248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com value->fType = SkType_Float; 2258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return true; 2268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 2278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkASSERT(0); 2288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return false; 2298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 230