diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-17 16:44:46 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-17 16:44:46 +0000 |
commit | 8f4d2306fa866a26f9448048ff63f692b2ba43aa (patch) | |
tree | 7a48d817cb5220f87e81781320b002eead2495a0 /src/utils/SkParse.cpp | |
parent | a34b638b909f58dd7c66546a0f49923112f7f785 (diff) |
remove SK_SCALAR_IS_[FLOAT,FIXED] and assume floats
To keep the CL (slightly) managable, this does not make any changes to
existing macros (e.g. SkScalarMul). Just tackling #ifdef constructs this
time around.
BUG=
R=bsalomon@google.com, caryclark@google.com
Review URL: https://codereview.chromium.org/117053002
git-svn-id: http://skia.googlecode.com/svn/trunk@12712 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/utils/SkParse.cpp')
-rw-r--r-- | src/utils/SkParse.cpp | 45 |
1 files changed, 1 insertions, 44 deletions
diff --git a/src/utils/SkParse.cpp b/src/utils/SkParse.cpp index 9609ddc568..f6e2a438e8 100644 --- a/src/utils/SkParse.cpp +++ b/src/utils/SkParse.cpp @@ -201,7 +201,7 @@ const char* SkParse::FindMSec(const char str[], SkMSec* value) const char* SkParse::FindScalar(const char str[], SkScalar* value) { SkASSERT(str); str = skip_ws(str); -#ifdef SK_SCALAR_IS_FLOAT + char* stop; float v = (float)strtod(str, &stop); if (str == stop) { @@ -211,49 +211,6 @@ const char* SkParse::FindScalar(const char str[], SkScalar* value) { *value = v; } return stop; -#else - int sign = 0; - if (*str == '-') - { - sign = -1; - str += 1; - } - - if (!is_digit(*str) && *str != '.') - return NULL; - - int n = 0; - while (is_digit(*str)) - { - n = 10*n + *str - '0'; - if (n > 0x7FFF) - return NULL; - str += 1; - } - n <<= 16; - - if (*str == '.') - { - static const int gFractions[] = { (1 << 24) / 10, (1 << 24) / 100, (1 << 24) / 1000, - (1 << 24) / 10000, (1 << 24) / 100000 }; - str += 1; - int d = 0; - const int* fraction = gFractions; - const int* end = &fraction[SK_ARRAY_COUNT(gFractions)]; - while (is_digit(*str) && fraction < end) - d += (*str++ - '0') * *fraction++; - d += 0x80; // round - n += d >> 8; - } - while (is_digit(*str)) - str += 1; - if (value) - { - n = (n ^ sign) - sign; // apply the sign - *value = SkFixedToScalar(n); - } -#endif - return str; } const char* SkParse::FindScalars(const char str[], SkScalar value[], int count) |