aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/config/SkUserConfig.h7
-rw-r--r--include/core/SkFixed.h14
-rw-r--r--include/core/SkFloatBits.h4
-rw-r--r--include/core/SkFloatingPoint.h3
-rw-r--r--include/core/SkPostConfig.h11
-rw-r--r--include/core/SkPreConfig.h1
-rw-r--r--include/core/SkScalar.h10
-rw-r--r--include/core/SkString.h2
-rw-r--r--src/animator/SkAnimateBase.cpp4
-rw-r--r--src/animator/SkAnimateField.cpp10
-rw-r--r--src/animator/SkAnimateSet.cpp4
-rw-r--r--src/animator/SkDisplayEvent.cpp4
-rw-r--r--src/animator/SkDisplayPost.cpp8
-rw-r--r--src/animator/SkDisplayRandom.cpp6
-rw-r--r--src/animator/SkDisplayType.h4
-rw-r--r--src/animator/SkDisplayTypes.cpp4
-rw-r--r--src/animator/SkDisplayable.cpp16
-rw-r--r--src/animator/SkScript.cpp18
-rw-r--r--src/animator/SkScriptDecompile.cpp4
-rw-r--r--src/animator/SkScriptTokenizer.cpp14
-rw-r--r--src/core/SkCordic.cpp6
-rw-r--r--src/core/SkEdge.h4
-rw-r--r--src/core/SkFloat.cpp6
-rw-r--r--src/core/SkFloatBits.cpp3
-rw-r--r--src/core/SkMatrix.cpp6
-rw-r--r--src/core/SkPath.cpp19
-rw-r--r--src/core/SkString.cpp2
-rw-r--r--tests/MathTest.cpp20
-rw-r--r--tests/ScalarTest.cpp6
-rw-r--r--tests/Sk64Test.cpp2
30 files changed, 18 insertions, 204 deletions
diff --git a/include/config/SkUserConfig.h b/include/config/SkUserConfig.h
index 9fdbd0a367..e7f781d733 100644
--- a/include/config/SkUserConfig.h
+++ b/include/config/SkUserConfig.h
@@ -45,13 +45,6 @@
//#define SK_SCALAR_IS_FIXED
-/* Somewhat independent of how SkScalar is implemented, Skia also wants to know
- if it can use floats at all. Naturally, if SK_SCALAR_IS_FLOAT is defined,
- SK_CAN_USE_FLOAT must be too; but if scalars are fixed, SK_CAN_USE_FLOAT
- can go either way.
- */
-//#define SK_CAN_USE_FLOAT
-
/* For some performance-critical scalar operations, skia will optionally work
around the standard float operators if it knows that the CPU does not have
native support for floats. If your environment uses software floating point,
diff --git a/include/core/SkFixed.h b/include/core/SkFixed.h
index 2040f14de8..96225e20c2 100644
--- a/include/core/SkFixed.h
+++ b/include/core/SkFixed.h
@@ -30,8 +30,7 @@ typedef int32_t SkFixed;
#define SK_FixedTanPIOver8 (0x6A0A)
#define SK_FixedRoot2Over2 (0xB505)
-#ifdef SK_CAN_USE_FLOAT
- #define SkFixedToFloat(x) ((x) * 1.5258789e-5f)
+#define SkFixedToFloat(x) ((x) * 1.5258789e-5f)
#if 1
#define SkFloatToFixed(x) ((SkFixed)((x) * SK_Fixed1))
#else
@@ -42,9 +41,8 @@ typedef int32_t SkFixed;
}
#endif
- #define SkFixedToDouble(x) ((x) * 1.5258789e-5)
- #define SkDoubleToFixed(x) ((SkFixed)((x) * SK_Fixed1))
-#endif
+#define SkFixedToDouble(x) ((x) * 1.5258789e-5)
+#define SkDoubleToFixed(x) ((SkFixed)((x) * SK_Fixed1))
/** 32 bit signed integer used to represent fractions values with 30 bits to the right of the decimal point
*/
@@ -53,10 +51,8 @@ typedef int32_t SkFract;
#define Sk_FracHalf (1 << 29)
#define SK_FractPIOver180 (0x11DF46A)
-#ifdef SK_CAN_USE_FLOAT
- #define SkFractToFloat(x) ((float)(x) * 0.00000000093132257f)
- #define SkFloatToFract(x) ((SkFract)((x) * SK_Fract1))
-#endif
+#define SkFractToFloat(x) ((float)(x) * 0.00000000093132257f)
+#define SkFloatToFract(x) ((SkFract)((x) * SK_Fract1))
/** Converts an integer to a SkFixed, asserting that the result does not overflow
a 32 bit signed integer
diff --git a/include/core/SkFloatBits.h b/include/core/SkFloatBits.h
index e6fc5b5616..3c725fe3c6 100644
--- a/include/core/SkFloatBits.h
+++ b/include/core/SkFloatBits.h
@@ -57,8 +57,6 @@ SK_API int32_t SkFloatBits_toIntRound(int32_t floatBits);
SK_API int32_t SkFloatBits_toIntCeil(int32_t floatBits);
-#ifdef SK_CAN_USE_FLOAT
-
union SkFloatIntUnion {
float fFloat;
int32_t fSignBitInt;
@@ -127,8 +125,6 @@ static inline int32_t SkFloatToIntCeil(float x) {
return SkFloatBits_toIntCeil(SkFloat2Bits(x));
}
-#endif
-
// Scalar wrappers for float-bit routines
#ifdef SK_SCALAR_IS_FLOAT
diff --git a/include/core/SkFloatingPoint.h b/include/core/SkFloatingPoint.h
index ee91cd9799..9f354fbfae 100644
--- a/include/core/SkFloatingPoint.h
+++ b/include/core/SkFloatingPoint.h
@@ -12,8 +12,6 @@
#include "SkTypes.h"
-#ifdef SK_CAN_USE_FLOAT
-
#include <math.h>
#include <float.h>
#include "SkFloatBits.h"
@@ -89,4 +87,3 @@ static inline float sk_float_copysign(float x, float y) {
#endif
#endif
-#endif
diff --git a/include/core/SkPostConfig.h b/include/core/SkPostConfig.h
index 8316f7a0a4..aea7982bfa 100644
--- a/include/core/SkPostConfig.h
+++ b/include/core/SkPostConfig.h
@@ -27,16 +27,7 @@
#if defined(SK_SCALAR_IS_FIXED) && defined(SK_SCALAR_IS_FLOAT)
#error "cannot define both SK_SCALAR_IS_FIXED and SK_SCALAR_IS_FLOAT"
#elif !defined(SK_SCALAR_IS_FIXED) && !defined(SK_SCALAR_IS_FLOAT)
- #ifdef SK_CAN_USE_FLOAT
- #define SK_SCALAR_IS_FLOAT
- #else
- #define SK_SCALAR_IS_FIXED
- #endif
-#endif
-
-#if defined(SK_SCALAR_IS_FLOAT) && !defined(SK_CAN_USE_FLOAT)
- #define SK_CAN_USE_FLOAT
- // we do nothing in the else case: fixed-scalars can have floats or not
+ #define SK_SCALAR_IS_FLOAT
#endif
#if defined(SK_CPU_LENDIAN) && defined(SK_CPU_BENDIAN)
diff --git a/include/core/SkPreConfig.h b/include/core/SkPreConfig.h
index 46c69298c5..ff19806cc8 100644
--- a/include/core/SkPreConfig.h
+++ b/include/core/SkPreConfig.h
@@ -88,7 +88,6 @@
#if !defined(SK_SCALAR_IS_FLOAT) && !defined(SK_SCALAR_IS_FIXED)
#define SK_SCALAR_IS_FLOAT
- #define SK_CAN_USE_FLOAT
#endif
//////////////////////////////////////////////////////////////////////
diff --git a/include/core/SkScalar.h b/include/core/SkScalar.h
index 0744079f11..c87342c152 100644
--- a/include/core/SkScalar.h
+++ b/include/core/SkScalar.h
@@ -222,13 +222,11 @@
#define SkIntToScalar(n) SkIntToFixed(n)
#define SkFixedToScalar(x) (x)
#define SkScalarToFixed(x) (x)
- #ifdef SK_CAN_USE_FLOAT
- #define SkScalarToFloat(n) SkFixedToFloat(n)
- #define SkFloatToScalar(n) SkFloatToFixed(n)
+ #define SkScalarToFloat(n) SkFixedToFloat(n)
+ #define SkFloatToScalar(n) SkFloatToFixed(n)
- #define SkScalarToDouble(n) SkFixedToDouble(n)
- #define SkDoubleToScalar(n) SkDoubleToFixed(n)
- #endif
+ #define SkScalarToDouble(n) SkFixedToDouble(n)
+ #define SkDoubleToScalar(n) SkDoubleToFixed(n)
#define SkScalarFraction(x) SkFixedFraction(x)
#define SkScalarFloorToScalar(x) SkFixedFloorToFixed(x)
diff --git a/include/core/SkString.h b/include/core/SkString.h
index 3dd89a5c9a..baabf0f543 100644
--- a/include/core/SkString.h
+++ b/include/core/SkString.h
@@ -55,9 +55,7 @@ char* SkStrAppendS64(char buffer[], int64_t, int minDigits);
#define SkStrAppendScalar SkStrAppendFixed
#endif
-#ifdef SK_CAN_USE_FLOAT
char* SkStrAppendFloat(char buffer[], float);
-#endif
char* SkStrAppendFixed(char buffer[], SkFixed);
/** \class SkString
diff --git a/src/animator/SkAnimateBase.cpp b/src/animator/SkAnimateBase.cpp
index 2c9e862d16..fe3815d75d 100644
--- a/src/animator/SkAnimateBase.cpp
+++ b/src/animator/SkAnimateBase.cpp
@@ -91,11 +91,7 @@ void SkAnimateBase::dump(SkAnimateMaker* maker) {
SkDebugf("to=\"%s\" ", to.c_str());
}
if (begin != 0) {
-#ifdef SK_CAN_USE_FLOAT
SkDebugf("begin=\"%g\" ", SkScalarToFloat(SkScalarDiv(begin,1000)));
-#else
- SkDebugf("begin=\"%x\" ", SkScalarDiv(begin,1000));
-#endif
}
}
#endif
diff --git a/src/animator/SkAnimateField.cpp b/src/animator/SkAnimateField.cpp
index ac96bbc520..65e084a0a5 100644
--- a/src/animator/SkAnimateField.cpp
+++ b/src/animator/SkAnimateField.cpp
@@ -41,15 +41,9 @@ void SkAnimate::dump(SkAnimateMaker* maker) {
SkDebugf("mirror=\"true\" ");
if (fReset)
SkDebugf("reset=\"true\" ");
-#ifdef SK_CAN_USE_FLOAT
SkDebugf("dur=\"%g\" ", SkScalarToFloat(SkScalarDiv(dur,1000)));
if (repeat != SK_Scalar1)
SkDebugf("repeat=\"%g\" ", SkScalarToFloat(repeat));
-#else
- SkDebugf("dur=\"%x\" ", SkScalarDiv(dur,1000));
- if (repeat != SK_Scalar1)
- SkDebugf("repeat=\"%x\" ", repeat);
-#endif
//if (fHasValues)
// SkDebugf("values=\"%s\" ", values);
if (blend.count() != 1 || blend[0] != SK_Scalar1) {
@@ -59,11 +53,7 @@ void SkAnimate::dump(SkAnimateMaker* maker) {
if (!firstElem)
SkDebugf(",");
firstElem = false;
-#ifdef SK_CAN_USE_FLOAT
SkDebugf("%g", SkScalarToFloat(blend[i]));
-#else
- SkDebugf("%x", blend[i]);
-#endif
}
SkDebugf("]\" ");
}
diff --git a/src/animator/SkAnimateSet.cpp b/src/animator/SkAnimateSet.cpp
index d0b4dfc60c..3dd9648afa 100644
--- a/src/animator/SkAnimateSet.cpp
+++ b/src/animator/SkAnimateSet.cpp
@@ -39,11 +39,7 @@ SkSet::SkSet() {
void SkSet::dump(SkAnimateMaker* maker) {
INHERITED::dump(maker);
if (dur != 1) {
-#ifdef SK_CAN_USE_FLOAT
SkDebugf("dur=\"%g\" ", SkScalarToFloat(SkScalarDiv(dur,1000)));
-#else
- SkDebugf("dur=\"%x\" ", SkScalarDiv(dur,1000));
-#endif
}
//don't want double />\n's
SkDebugf("/>\n");
diff --git a/src/animator/SkDisplayEvent.cpp b/src/animator/SkDisplayEvent.cpp
index 7d2e786092..0eb956a361 100644
--- a/src/animator/SkDisplayEvent.cpp
+++ b/src/animator/SkDisplayEvent.cpp
@@ -104,11 +104,7 @@ void SkDisplayEvent::dumpEvent(SkAnimateMaker* maker) {
SkDebugf("target=\"%s\" ", fTarget->id);
}
if (kind >= SkDisplayEvent::kMouseDown && kind <= SkDisplayEvent::kMouseUp) {
-#ifdef SK_CAN_USE_FLOAT
SkDebugf("x=\"%g\" y=\"%g\" ", SkScalarToFloat(x), SkScalarToFloat(y));
-#else
- SkDebugf("x=\"%x\" y=\"%x\" ", x, y);
-#endif
}
if (disable)
SkDebugf("disable=\"true\" ");
diff --git a/src/animator/SkDisplayPost.cpp b/src/animator/SkDisplayPost.cpp
index 8283a9cf0b..bf89055c28 100644
--- a/src/animator/SkDisplayPost.cpp
+++ b/src/animator/SkDisplayPost.cpp
@@ -76,11 +76,7 @@ void SkPost::dump(SkAnimateMaker* maker) {
delete eventType;
if (delay > 0) {
-#ifdef SK_CAN_USE_FLOAT
SkDebugf("delay=\"%g\" ", SkScalarToFloat(SkScalarDiv(delay, 1000)));
-#else
- SkDebugf("delay=\"%x\" ", SkScalarDiv(delay, 1000));
-#endif
}
// if (initialized == false)
// SkDebugf("(uninitialized) ");
@@ -131,11 +127,7 @@ void SkPost::dump(SkAnimateMaker* maker) {
case SkMetaData::kScalar_Type: {
SkScalar scalar;
meta.findScalar(name, &scalar);
-#ifdef SK_CAN_USE_FLOAT
SkDebugf("float=\"%g\" ", SkScalarToFloat(scalar));
-#else
- SkDebugf("float=\"%x\" ", scalar);
-#endif
} break;
case SkMetaData::kString_Type:
SkDebugf("string=\"%s\" ", meta.findString(name));
diff --git a/src/animator/SkDisplayRandom.cpp b/src/animator/SkDisplayRandom.cpp
index ac6c3a13ed..3f77fcb03c 100644
--- a/src/animator/SkDisplayRandom.cpp
+++ b/src/animator/SkDisplayRandom.cpp
@@ -35,15 +35,9 @@ SkDisplayRandom::SkDisplayRandom() : blend(0), min(0), max(SK_Scalar1) {
#ifdef SK_DUMP_ENABLED
void SkDisplayRandom::dump(SkAnimateMaker* maker) {
dumpBase(maker);
-#ifdef SK_CAN_USE_FLOAT
SkDebugf("min=\"%g\" ", SkScalarToFloat(min));
SkDebugf("max=\"%g\" ", SkScalarToFloat(max));
SkDebugf("blend=\"%g\" ", SkScalarToFloat(blend));
-#else
- SkDebugf("min=\"%x\" ", min);
- SkDebugf("max=\"%x\" ", max);
- SkDebugf("blend=\"%x\" ", blend);
-#endif
SkDebugf("/>\n");
}
#endif
diff --git a/src/animator/SkDisplayType.h b/src/animator/SkDisplayType.h
index fe82b319c2..dcbf5d406c 100644
--- a/src/animator/SkDisplayType.h
+++ b/src/animator/SkDisplayType.h
@@ -14,9 +14,7 @@
#include "SkScalar.h"
#ifdef SK_DEBUG
- #ifdef SK_CAN_USE_FLOAT
- #define SK_DUMP_ENABLED
- #endif
+ #define SK_DUMP_ENABLED
#ifdef SK_BUILD_FOR_MAC
#define SK_FIND_LEAKS
#endif
diff --git a/src/animator/SkDisplayTypes.cpp b/src/animator/SkDisplayTypes.cpp
index 6132eb7a17..d3bfa101aa 100644
--- a/src/animator/SkDisplayTypes.cpp
+++ b/src/animator/SkDisplayTypes.cpp
@@ -81,11 +81,7 @@ SkDisplayFloat::SkDisplayFloat() : value(0) {
#ifdef SK_DUMP_ENABLED
void SkDisplayFloat::dump(SkAnimateMaker* maker) {
dumpBase(maker);
-#ifdef SK_CAN_USE_FLOAT
SkDebugf("value=\"%g\" />\n", SkScalarToFloat(value));
-#else
- SkDebugf("value=\"%x\" />\n", value);
-#endif
}
#endif
diff --git a/src/animator/SkDisplayable.cpp b/src/animator/SkDisplayable.cpp
index ebcc8a3605..396ce6b769 100644
--- a/src/animator/SkDisplayable.cpp
+++ b/src/animator/SkDisplayable.cpp
@@ -205,11 +205,7 @@ void SkDisplayable::dumpAttrs(SkAnimateMaker* maker) {
SkDebugf("%d", op->fS32);
break;
case SkType_Float:
-#ifdef SK_CAN_USE_FLOAT
SkDebugf("%g", SkScalarToFloat(op->fScalar));
-#else
- SkDebugf("%x", op->fScalar);
-#endif
break;
case SkType_String:
case SkType_DynamicString:
@@ -311,11 +307,7 @@ void SkDisplayable::dumpValues(const SkMemberInfo* info, SkDisplayTypes type, Sk
//should make this a separate case in dump attrs, rather than make dump values have a larger signature
case SkType_Point:
if (op.fScalar != blankOp.fScalar || op2.fScalar != blankOp.fScalar) {
-#ifdef SK_CAN_USE_FLOAT
SkDebugf("%s=\"[%g,%g]\" ", info->fName, SkScalarToFloat(op.fScalar), SkScalarToFloat(op2.fScalar));
-#else
- SkDebugf("%s=\"[%x,%x]\" ", info->fName, op.fScalar, op2.fScalar);
-#endif
}
break;
case SkType_FromPathMode:
@@ -375,11 +367,7 @@ void SkDisplayable::dumpValues(const SkMemberInfo* info, SkDisplayTypes type, Sk
break;
case SkType_Float:
if (op.fScalar != blankOp.fScalar) { //or /65536?
-#ifdef SK_CAN_USE_FLOAT
SkDebugf("%s=\"%g\" ", info->fName, SkScalarToFloat(op.fScalar));
-#else
- SkDebugf("%s=\"%x\" ", info->fName, op.fScalar);
-#endif
}
break;
case SkType_String:
@@ -389,11 +377,7 @@ void SkDisplayable::dumpValues(const SkMemberInfo* info, SkDisplayTypes type, Sk
break;
case SkType_MSec:
if (op.fS32 != blankOp.fS32) {
-#ifdef SK_CAN_USE_FLOAT
SkDebugf(" %s=\"%g\" ", info->fName, SkScalarToFloat(SkScalarDiv(op.fS32, 1000)));
-#else
- SkDebugf(" %s=\"%x\" ", info->fName, SkScalarDiv(op.fS32, 1000));
-#endif
}
default:
SkDebugf("");
diff --git a/src/animator/SkScript.cpp b/src/animator/SkScript.cpp
index aa061698e8..3b498fa64b 100644
--- a/src/animator/SkScript.cpp
+++ b/src/animator/SkScript.cpp
@@ -1644,9 +1644,7 @@ bool SkScriptEngine::ValueToString(SkScriptValue value, SkString* string) {
#ifdef SK_SUPPORT_UNITTEST
-#ifdef SK_CAN_USE_FLOAT
- #include "SkFloatingPoint.h"
-#endif
+#include "SkFloatingPoint.h"
#define DEF_SCALAR_ANSWER 0
#define DEF_STRING_ANSWER NULL
@@ -1656,10 +1654,8 @@ bool SkScriptEngine::ValueToString(SkScriptValue value, SkString* string) {
#define testScalar(expression) { #expression, SkType_Float, 0, (float) expression, DEF_STRING_ANSWER }
#define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkType_Float, 0, sk_float_mod(exp1, exp2), DEF_STRING_ANSWER }
#else
- #ifdef SK_CAN_USE_FLOAT
- #define testScalar(expression) { #expression, SkType_Float, 0, (int) ((expression) * 65536.0f), DEF_STRING_ANSWER }
- #define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkType_Float, 0, (int) (sk_float_mod(exp1, exp2) * 65536.0f), DEF_STRING_ANSWER }
- #endif
+ #define testScalar(expression) { #expression, SkType_Float, 0, (int) ((expression) * 65536.0f), DEF_STRING_ANSWER }
+ #define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkType_Float, 0, (int) (sk_float_mod(exp1, exp2) * 65536.0f), DEF_STRING_ANSWER }
#endif
#define testTrue(expression) { #expression, SkType_Int, 1, DEF_SCALAR_ANSWER, DEF_STRING_ANSWER }
#define testFalse(expression) { #expression, SkType_Int, 0, DEF_SCALAR_ANSWER, DEF_STRING_ANSWER }
@@ -1669,7 +1665,6 @@ static const SkScriptNAnswer scriptTests[] = {
testInt((6+7)*8),
testInt(0&&1?2:3),
testInt(3*(4+5)),
-#ifdef SK_CAN_USE_FLOAT
testScalar(1.0+2.0),
testScalar(1.0+5),
testScalar(3.0-1.0),
@@ -1689,7 +1684,6 @@ static const SkScriptNAnswer scriptTests[] = {
testFalse(-9!=-9.0),
testFalse(-9.!=-4.0-5),
testFalse(-9.*1!=-4-5),
-#endif
testInt(0x123),
testInt(0XABC),
testInt(0xdeadBEEF),
@@ -1740,7 +1734,6 @@ static const SkScriptNAnswer scriptTests[] = {
testInt(2!=2),
testInt(2!=11),
testInt(20!=11),
-#ifdef SK_CAN_USE_FLOAT
// left int, right scalar
testInt(2<2.),
testInt(2<11.),
@@ -1797,7 +1790,6 @@ static const SkScriptNAnswer scriptTests[] = {
testInt(2.!=2.),
testInt(2.!=11.),
testInt(20.!=11.),
-#endif
// int, string (string is int)
testFalse(2<'2'),
testTrue(2<'11'),
@@ -1821,7 +1813,6 @@ static const SkScriptNAnswer scriptTests[] = {
testFalse(20<'11.'),
testTrue(2=='2.'),
testFalse(2=='11.'),
-#ifdef SK_CAN_USE_FLOAT
// scalar, string
testFalse(2.<'2.'),
testTrue(2.<'11.'),
@@ -1840,7 +1831,6 @@ static const SkScriptNAnswer scriptTests[] = {
testFalse('20'<11.),
testTrue('2'==2.),
testFalse('2'==11.),
-#endif
// string, string
testFalse('2'<'2'),
testFalse('2'<'11'),
@@ -1873,9 +1863,7 @@ static const SkScriptNAnswer scriptTests[] = {
testInt(0?2:3?4:5),
testInt(1?0:3?4:5),
testInt(0?0:3?4:5)
-#ifdef SK_CAN_USE_FLOAT
, { "123.5", SkType_Float, 0, SkIntToScalar(123) + SK_Scalar1/2, DEF_STRING_ANSWER }
-#endif
};
#define SkScriptNAnswer_testCount SK_ARRAY_COUNT(scriptTests)
diff --git a/src/animator/SkScriptDecompile.cpp b/src/animator/SkScriptDecompile.cpp
index 933e0d7c2b..26b678c79d 100644
--- a/src/animator/SkScriptDecompile.cpp
+++ b/src/animator/SkScriptDecompile.cpp
@@ -155,11 +155,7 @@ void SkScriptEngine2::decompile(const unsigned char* start, size_t length) {
SkScalar scalar;
memcpy(&scalar, opCode, sizeof(scalar));
opCode += sizeof(SkScalar);
-#ifdef SK_CAN_USE_FLOAT
SkDebugf(" scalar: %g", SkScalarToFloat(scalar));
-#else
- SkDebugf(" scalar: %x", scalar);
-#endif
} break;
case SkScriptEngine2::kStringAccumulator:
case SkScriptEngine2::kStringOperand: {
diff --git a/src/animator/SkScriptTokenizer.cpp b/src/animator/SkScriptTokenizer.cpp
index b2b6e4f0b1..54aa2bff8b 100644
--- a/src/animator/SkScriptTokenizer.cpp
+++ b/src/animator/SkScriptTokenizer.cpp
@@ -1279,23 +1279,18 @@ bool SkScriptEngine2::ValueToString(const SkScriptValue2& value, SkString* strin
#define testScalar(expression) { #expression, SkOperand2::kScalar, 0, (float) expression, NULL }
#define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkOperand2::kScalar, 0, fmodf(exp1, exp2), NULL }
#else
-#ifdef SK_CAN_USE_FLOAT
#define testScalar(expression) { #expression, SkOperand2::kScalar, 0, (int) ((expression) * 65536.0f), NULL }
#define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkOperand2::kScalar, 0, (int) (fmod(exp1, exp2) * 65536.0f), NULL }
#endif
-#endif
#define testTrue(expression) { #expression, SkOperand2::kS32, 1, 0, NULL }
#define testFalse(expression) { #expression, SkOperand2::kS32, 0, 0, NULL }
static const SkScriptNAnswer2 scriptTests[] = {
testInt(1||(0&&3)),
-#ifdef SK_CAN_USE_FLOAT
testScalar(- -5.5- -1.5),
testScalar(1.0+5),
-#endif
testInt((6+7)*8),
testInt(3*(4+5)),
-#ifdef SK_CAN_USE_FLOAT
testScalar(1.0+2.0),
testScalar(3.0-1.0),
testScalar(6-1.0),
@@ -1313,7 +1308,6 @@ static const SkScriptNAnswer2 scriptTests[] = {
testFalse(-9!=-9.0),
testFalse(-9.!=-4.0-5),
testFalse(-9.*1!=-4-5),
-#endif
testInt(0x123),
testInt(0XABC),
testInt(0xdeadBEEF),
@@ -1364,7 +1358,6 @@ static const SkScriptNAnswer2 scriptTests[] = {
testInt(2!=2),
testInt(2!=11),
testInt(20!=11),
-#ifdef SK_CAN_USE_FLOAT
// left int, right scalar
testInt(2<2.),
testInt(2<11.),
@@ -1421,7 +1414,6 @@ static const SkScriptNAnswer2 scriptTests[] = {
testInt(2.!=2.),
testInt(2.!=11.),
testInt(20.!=11.),
-#endif
// int, string (string is int)
testFalse(2<'2'),
testTrue(2<'11'),
@@ -1445,7 +1437,6 @@ static const SkScriptNAnswer2 scriptTests[] = {
testFalse(20<'11.'),
testTrue(2=='2.'),
testFalse(2=='11.'),
-#ifdef SK_CAN_USE_FLOAT
// scalar, string
testFalse(2.<'2.'),
testTrue(2.<'11.'),
@@ -1464,7 +1455,6 @@ static const SkScriptNAnswer2 scriptTests[] = {
testFalse('20'<11.),
testTrue('2'==2.),
testFalse('2'==11.),
-#endif
// string, string
testFalse('2'<'2'),
testFalse('2'<'11'),
@@ -1481,9 +1471,7 @@ static const SkScriptNAnswer2 scriptTests[] = {
testInt(0||(0&&3)),
testInt(0||(1&&3)),
testInt(0&&1?2:3)
-#ifdef SK_CAN_USE_FLOAT
, { "123.5", SkOperand2::kScalar, 0, SkIntToScalar(123) + SK_Scalar1/2, NULL }
-#endif
};
#define SkScriptNAnswer_testCount SK_ARRAY_COUNT(scriptTests)
@@ -1507,10 +1495,8 @@ void SkScriptEngine2::UnitTest() {
break;
case SkOperand2::kScalar:
error = SkScalarAbs(value.fOperand.fScalar - scriptTests[index].fScalarAnswer);
-#ifdef SK_CAN_USE_FLOAT
if (error >= SK_Scalar1 / 10000)
SkDEBUGF(("script '%s' == value %g != expected answer %g\n", script, value.fOperand.fScalar / (1.0f * SK_Scalar1), scriptTests[index].fScalarAnswer / (1.0f * SK_Scalar1)));
-#endif
SkASSERT(error < SK_Scalar1 / 10000);
break;
case SkOperand2::kString:
diff --git a/src/core/SkCordic.cpp b/src/core/SkCordic.cpp
index 8fb60c547f..14d34fb9fd 100644
--- a/src/core/SkCordic.cpp
+++ b/src/core/SkCordic.cpp
@@ -197,13 +197,11 @@ SkFixed SkCordicExp(SkFixed a) {
#ifdef SK_DEBUG
-#ifdef SK_CAN_USE_FLOAT
- #include "SkFloatingPoint.h"
-#endif
+#include "SkFloatingPoint.h"
void SkCordic_UnitTest()
{
-#if defined(SK_SUPPORT_UNITTEST) && defined(SK_CAN_USE_FLOAT)
+#if defined(SK_SUPPORT_UNITTEST)
float val;
for (float angle = -720; angle < 720; angle += 30) {
float radian = angle * 3.1415925358f / 180.0f;
diff --git a/src/core/SkEdge.h b/src/core/SkEdge.h
index 29a50d1520..575b6021a1 100644
--- a/src/core/SkEdge.h
+++ b/src/core/SkEdge.h
@@ -43,11 +43,7 @@ struct SkEdge {
#ifdef SK_DEBUG
void dump() const {
- #ifdef SK_CAN_USE_FLOAT
SkDebugf("edge: firstY:%d lastY:%d x:%g dx:%g w:%d\n", fFirstY, fLastY, SkFixedToFloat(fX), SkFixedToFloat(fDX), fWinding);
- #else
- SkDebugf("edge: firstY:%d lastY:%d x:%x dx:%x w:%d\n", fFirstY, fLastY, fX, fDX, fWinding);
- #endif
}
void validate() const {
diff --git a/src/core/SkFloat.cpp b/src/core/SkFloat.cpp
index ffa5d9a0b8..ec785f320b 100644
--- a/src/core/SkFloat.cpp
+++ b/src/core/SkFloat.cpp
@@ -268,9 +268,7 @@ int SkFloat::Cmp(int32_t packed_a, int32_t packed_b)
#ifdef SK_DEBUG
#include "SkRandom.h"
-#ifdef SK_CAN_USE_FLOAT
- #include "SkFloatingPoint.h"
-#endif
+#include "SkFloatingPoint.h"
void SkFloat::UnitTest()
{
@@ -295,7 +293,6 @@ void SkFloat::UnitTest()
SkRandom rand;
-#ifdef SK_CAN_USE_FLOAT
int i;
for (i = 0; i < 1000; i++)
{
@@ -391,7 +388,6 @@ void SkFloat::UnitTest()
#endif
}
#endif
-#endif
}
#endif
diff --git a/src/core/SkFloatBits.cpp b/src/core/SkFloatBits.cpp
index fc46005f93..378f98db43 100644
--- a/src/core/SkFloatBits.cpp
+++ b/src/core/SkFloatBits.cpp
@@ -152,8 +152,6 @@ int32_t SkFloatBits_toIntCeil(int32_t packed) {
}
}
-#ifdef SK_CAN_USE_FLOAT
-
float SkIntToFloatCast(int32_t value) {
if (0 == value) {
return 0;
@@ -207,4 +205,3 @@ float SkIntToFloatCast_NoOverflowCheck(int32_t value) {
return data.fFloat;
}
-#endif
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index 7133658dad..85cb7c6bb9 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -1760,7 +1760,6 @@ void SkMatrix::dump() const {
}
void SkMatrix::toDumpString(SkString* str) const {
-#ifdef SK_CAN_USE_FLOAT
str->printf("[%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f]",
#ifdef SK_SCALAR_IS_FLOAT
fMat[0], fMat[1], fMat[2], fMat[3], fMat[4], fMat[5],
@@ -1770,9 +1769,4 @@ void SkMatrix::toDumpString(SkString* str) const {
SkFixedToFloat(fMat[3]), SkFixedToFloat(fMat[4]), SkFixedToFloat(fMat[5]),
SkFractToFloat(fMat[6]), SkFractToFloat(fMat[7]), SkFractToFloat(fMat[8]));
#endif
-#else // can't use float
- str->printf("[%x %x %x][%x %x %x][%x %x %x]",
- fMat[0], fMat[1], fMat[2], fMat[3], fMat[4], fMat[5],
- fMat[6], fMat[7], fMat[8]);
-#endif
}
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 034a515b50..7688f10f48 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1738,42 +1738,23 @@ void SkPath::dump(bool forceClose, const char title[]) const {
while ((verb = iter.next(pts, false)) != kDone_Verb) {
switch (verb) {
case kMove_Verb:
-#ifdef SK_CAN_USE_FLOAT
SkDebugf(" path: moveTo [%g %g]\n",
SkScalarToFloat(pts[0].fX), SkScalarToFloat(pts[0].fY));
-#else
- SkDebugf(" path: moveTo [%x %x]\n", pts[0].fX, pts[0].fY);
-#endif
break;
case kLine_Verb:
-#ifdef SK_CAN_USE_FLOAT
SkDebugf(" path: lineTo [%g %g]\n",
SkScalarToFloat(pts[1].fX), SkScalarToFloat(pts[1].fY));
-#else
- SkDebugf(" path: lineTo [%x %x]\n", pts[1].fX, pts[1].fY);
-#endif
break;
case kQuad_Verb:
-#ifdef SK_CAN_USE_FLOAT
SkDebugf(" path: quadTo [%g %g] [%g %g]\n",
SkScalarToFloat(pts[1].fX), SkScalarToFloat(pts[1].fY),
SkScalarToFloat(pts[2].fX), SkScalarToFloat(pts[2].fY));
-#else
- SkDebugf(" path: quadTo [%x %x] [%x %x]\n",
- pts[1].fX, pts[1].fY, pts[2].fX, pts[2].fY);
-#endif
break;
case kCubic_Verb:
-#ifdef SK_CAN_USE_FLOAT
SkDebugf(" path: cubeTo [%g %g] [%g %g] [%g %g]\n",
SkScalarToFloat(pts[1].fX), SkScalarToFloat(pts[1].fY),
SkScalarToFloat(pts[2].fX), SkScalarToFloat(pts[2].fY),
SkScalarToFloat(pts[3].fX), SkScalarToFloat(pts[3].fY));
-#else
- SkDebugf(" path: cubeTo [%x %x] [%x %x] [%x %x]\n",
- pts[1].fX, pts[1].fY, pts[2].fX, pts[2].fY,
- pts[3].fX, pts[3].fY);
-#endif
break;
case kClose_Verb:
SkDebugf(" path: close\n");
diff --git a/src/core/SkString.cpp b/src/core/SkString.cpp
index 85fecc9e04..d3775a524d 100644
--- a/src/core/SkString.cpp
+++ b/src/core/SkString.cpp
@@ -123,7 +123,6 @@ char* SkStrAppendS64(char string[], int64_t dec, int minDigits) {
return string;
}
-#ifdef SK_CAN_USE_FLOAT
char* SkStrAppendFloat(char string[], float value) {
// since floats have at most 8 significant digits, we limit our %g to that.
static const char gFormat[] = "%.8g";
@@ -134,7 +133,6 @@ char* SkStrAppendFloat(char string[], float value) {
SkASSERT(len <= SkStrAppendScalar_MaxSize);
return string + len;
}
-#endif
char* SkStrAppendFixed(char string[], SkFixed x) {
SkDEBUGCODE(char* start = string;)
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp
index 3deb79a69e..b41c47147d 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -163,7 +163,6 @@ static int symmetric_fixmul(int a, int b) {
static void check_length(skiatest::Reporter* reporter,
const SkPoint& p, SkScalar targetLen) {
-#ifdef SK_CAN_USE_FLOAT
float x = SkScalarToFloat(p.fX);
float y = SkScalarToFloat(p.fY);
float len = sk_float_sqrt(x*x + y*y);
@@ -171,11 +170,8 @@ static void check_length(skiatest::Reporter* reporter,
len /= SkScalarToFloat(targetLen);
REPORTER_ASSERT(reporter, len > 0.999f && len < 1.001f);
-#endif
}
-#if defined(SK_CAN_USE_FLOAT)
-
static float nextFloat(SkRandom& rand) {
SkFloatIntUnion data;
data.fSignBitInt = rand.nextU();
@@ -314,10 +310,7 @@ static void unittest_isfinite(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, SkScalarIsFinite(0));
}
-#endif
-
static void test_muldiv255(skiatest::Reporter* reporter) {
-#ifdef SK_CAN_USE_FLOAT
for (int a = 0; a <= 255; a++) {
for (int b = 0; b <= 255; b++) {
int ab = a * b;
@@ -336,7 +329,6 @@ static void test_muldiv255(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, iround <= b);
}
}
-#endif
}
static void test_muldiv255ceiling(skiatest::Reporter* reporter) {
@@ -368,12 +360,10 @@ static void test_copysign(skiatest::Reporter* reporter) {
for (size_t i = 0; i < SK_ARRAY_COUNT(gTriples); i += 3) {
REPORTER_ASSERT(reporter,
SkCopySign32(gTriples[i], gTriples[i+1]) == gTriples[i+2]);
-#ifdef SK_CAN_USE_FLOAT
float x = (float)gTriples[i];
float y = (float)gTriples[i+1];
float expected = (float)gTriples[i+2];
REPORTER_ASSERT(reporter, sk_float_copysign(x, y) == expected);
-#endif
}
SkRandom rand;
@@ -481,10 +471,8 @@ static void TestMath(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, result == 1);
}
-#ifdef SK_CAN_USE_FLOAT
unittest_fastfloat(reporter);
unittest_isfinite(reporter);
-#endif
#ifdef SkLONGLONG
for (i = 0; i < 10000; i++) {
@@ -527,7 +515,6 @@ static void TestMath(skiatest::Reporter* reporter) {
r2 = SkFixedSquare(numer);
REPORTER_ASSERT(reporter, result == r2);
-#ifdef SK_CAN_USE_FLOAT
if (numer >= 0 && denom >= 0) {
SkFixed mean = SkFixedMean(numer, denom);
float prod = SkFixedToFloat(numer) * SkFixedToFloat(denom);
@@ -547,11 +534,9 @@ static void TestMath(skiatest::Reporter* reporter) {
int diff = SkAbs32(mod - SkFloatToFixed(m));
REPORTER_ASSERT(reporter, (diff >> 7) == 0);
}
-#endif
}
#endif
-#ifdef SK_CAN_USE_FLOAT
for (i = 0; i < 10000; i++) {
SkFract x = rand.nextU() >> 1;
double xx = (double)x / SK_Fract1;
@@ -571,9 +556,8 @@ static void TestMath(skiatest::Reporter* reporter) {
check = (int32_t)sqrt(xx);
REPORTER_ASSERT(reporter, xr == check || xr == check-1);
}
-#endif
-#if !defined(SK_SCALAR_IS_FLOAT) && defined(SK_CAN_USE_FLOAT)
+#if !defined(SK_SCALAR_IS_FLOAT)
{
SkFixed s, c;
s = SkFixedSinCos(0, &c);
@@ -605,9 +589,7 @@ static void TestMath(skiatest::Reporter* reporter) {
test_blend(reporter);
#endif
-#ifdef SK_CAN_USE_FLOAT
test_floor(reporter);
-#endif
// disable for now
if (false) test_blend31(); // avoid bit rot, suppress warning
diff --git a/tests/ScalarTest.cpp b/tests/ScalarTest.cpp
index c56641d7ba..20719145f7 100644
--- a/tests/ScalarTest.cpp
+++ b/tests/ScalarTest.cpp
@@ -12,8 +12,6 @@
#include "SkRandom.h"
#include "SkRect.h"
-#ifdef SK_CAN_USE_FLOAT
-
struct PointSet {
const SkPoint* fPts;
size_t fCount;
@@ -94,8 +92,6 @@ static bool isFinite2_mulzeroadd(float x, float y, IsFiniteProc1 proc) {
// return true if both floats are finite
typedef bool (*IsFiniteProc2)(float, float, IsFiniteProc1);
-#endif
-
enum FloatClass {
kFinite,
kInfinite,
@@ -118,7 +114,6 @@ static void test_floatclass(skiatest::Reporter* reporter, float value, FloatClas
#endif
static void test_isfinite(skiatest::Reporter* reporter) {
-#ifdef SK_CAN_USE_FLOAT
struct Rec {
float fValue;
bool fIsFinite;
@@ -186,7 +181,6 @@ static void test_isfinite(skiatest::Reporter* reporter) {
}
test_isRectFinite(reporter);
-#endif
}
#if defined _WIN32
diff --git a/tests/Sk64Test.cpp b/tests/Sk64Test.cpp
index 64eef753b0..50b7ec7d2f 100644
--- a/tests/Sk64Test.cpp
+++ b/tests/Sk64Test.cpp
@@ -167,7 +167,6 @@ static void TestSk64(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, check == w);
-#ifdef SK_CAN_USE_FLOAT
wide.setMul(rand.nextS(), rand.nextS());
wide.abs();
denom = wide.getSqrt();
@@ -196,7 +195,6 @@ static void TestSk64(skiatest::Reporter* reporter) {
i, dnumer, ddenom, ddiv, dfixdiv, fixdiv);
}
REPORTER_ASSERT(reporter, SkAbs32(diff) <= 1);
-#endif
}
#endif
}