remove SK_CAN_USE_FLOAT (deprecated)
git-svn-id: http://skia.googlecode.com/svn/trunk@4232 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/config/SkUserConfig.h b/include/config/SkUserConfig.h
index 9fdbd0a..e7f781d 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 2040f14..96225e2 100644
--- a/include/core/SkFixed.h
+++ b/include/core/SkFixed.h
@@ -30,8 +30,7 @@
#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 @@
}
#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 @@
#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 e6fc5b5..3c725fe 100644
--- a/include/core/SkFloatBits.h
+++ b/include/core/SkFloatBits.h
@@ -57,8 +57,6 @@
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 @@
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 ee91cd9..9f354fb 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 @@
#endif
#endif
-#endif
diff --git a/include/core/SkPostConfig.h b/include/core/SkPostConfig.h
index 8316f7a..aea7982 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 46c6929..ff19806 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 0744079..c87342c 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 3dd89a5..baabf0f 100644
--- a/include/core/SkString.h
+++ b/include/core/SkString.h
@@ -55,9 +55,7 @@
#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 2c9e862..fe3815d 100644
--- a/src/animator/SkAnimateBase.cpp
+++ b/src/animator/SkAnimateBase.cpp
@@ -91,11 +91,7 @@
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 ac96bbc..65e084a 100644
--- a/src/animator/SkAnimateField.cpp
+++ b/src/animator/SkAnimateField.cpp
@@ -41,15 +41,9 @@
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 @@
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 d0b4dfc..3dd9648 100644
--- a/src/animator/SkAnimateSet.cpp
+++ b/src/animator/SkAnimateSet.cpp
@@ -39,11 +39,7 @@
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 7d2e786..0eb956a 100644
--- a/src/animator/SkDisplayEvent.cpp
+++ b/src/animator/SkDisplayEvent.cpp
@@ -104,11 +104,7 @@
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 8283a9c..bf89055 100644
--- a/src/animator/SkDisplayPost.cpp
+++ b/src/animator/SkDisplayPost.cpp
@@ -76,11 +76,7 @@
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 @@
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 ac6c3a1..3f77fcb 100644
--- a/src/animator/SkDisplayRandom.cpp
+++ b/src/animator/SkDisplayRandom.cpp
@@ -35,15 +35,9 @@
#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 fe82b31..dcbf5d4 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 6132eb7..d3bfa10 100644
--- a/src/animator/SkDisplayTypes.cpp
+++ b/src/animator/SkDisplayTypes.cpp
@@ -81,11 +81,7 @@
#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 ebcc8a3..396ce6b 100644
--- a/src/animator/SkDisplayable.cpp
+++ b/src/animator/SkDisplayable.cpp
@@ -205,11 +205,7 @@
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 @@
//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 @@
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 @@
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 aa06169..3b498fa 100644
--- a/src/animator/SkScript.cpp
+++ b/src/animator/SkScript.cpp
@@ -1644,9 +1644,7 @@
#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 @@
#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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
testFalse('20'<11.),
testTrue('2'==2.),
testFalse('2'==11.),
-#endif
// string, string
testFalse('2'<'2'),
testFalse('2'<'11'),
@@ -1873,9 +1863,7 @@
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 933e0d7..26b678c 100644
--- a/src/animator/SkScriptDecompile.cpp
+++ b/src/animator/SkScriptDecompile.cpp
@@ -155,11 +155,7 @@
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 b2b6e4f..54aa2bf 100644
--- a/src/animator/SkScriptTokenizer.cpp
+++ b/src/animator/SkScriptTokenizer.cpp
@@ -1279,23 +1279,18 @@
#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 @@
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 @@
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 @@
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 @@
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 @@
testFalse('20'<11.),
testTrue('2'==2.),
testFalse('2'==11.),
-#endif
// string, string
testFalse('2'<'2'),
testFalse('2'<'11'),
@@ -1481,9 +1471,7 @@
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 @@
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 8fb60c5..14d34fb 100644
--- a/src/core/SkCordic.cpp
+++ b/src/core/SkCordic.cpp
@@ -197,13 +197,11 @@
#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 29a50d1..575b602 100644
--- a/src/core/SkEdge.h
+++ b/src/core/SkEdge.h
@@ -43,11 +43,7 @@
#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 ffa5d9a..ec785f3 100644
--- a/src/core/SkFloat.cpp
+++ b/src/core/SkFloat.cpp
@@ -268,9 +268,7 @@
#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 @@
SkRandom rand;
-#ifdef SK_CAN_USE_FLOAT
int i;
for (i = 0; i < 1000; i++)
{
@@ -391,7 +388,6 @@
#endif
}
#endif
-#endif
}
#endif
diff --git a/src/core/SkFloatBits.cpp b/src/core/SkFloatBits.cpp
index fc46005..378f98d 100644
--- a/src/core/SkFloatBits.cpp
+++ b/src/core/SkFloatBits.cpp
@@ -152,8 +152,6 @@
}
}
-#ifdef SK_CAN_USE_FLOAT
-
float SkIntToFloatCast(int32_t value) {
if (0 == value) {
return 0;
@@ -207,4 +205,3 @@
return data.fFloat;
}
-#endif
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index 7133658..85cb7c6 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -1760,7 +1760,6 @@
}
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 @@
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 034a515..7688f10 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1738,42 +1738,23 @@
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 85fecc9..d3775a5 100644
--- a/src/core/SkString.cpp
+++ b/src/core/SkString.cpp
@@ -123,7 +123,6 @@
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 @@
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 3deb79a..b41c471 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -163,7 +163,6 @@
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 @@
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 @@
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 @@
REPORTER_ASSERT(reporter, iround <= b);
}
}
-#endif
}
static void test_muldiv255ceiling(skiatest::Reporter* reporter) {
@@ -368,12 +360,10 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 c56641d..2071914 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 @@
// return true if both floats are finite
typedef bool (*IsFiniteProc2)(float, float, IsFiniteProc1);
-#endif
-
enum FloatClass {
kFinite,
kInfinite,
@@ -118,7 +114,6 @@
#endif
static void test_isfinite(skiatest::Reporter* reporter) {
-#ifdef SK_CAN_USE_FLOAT
struct Rec {
float fValue;
bool fIsFinite;
@@ -186,7 +181,6 @@
}
test_isRectFinite(reporter);
-#endif
}
#if defined _WIN32
diff --git a/tests/Sk64Test.cpp b/tests/Sk64Test.cpp
index 64eef75..50b7ec7 100644
--- a/tests/Sk64Test.cpp
+++ b/tests/Sk64Test.cpp
@@ -167,7 +167,6 @@
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 @@
i, dnumer, ddenom, ddiv, dfixdiv, fixdiv);
}
REPORTER_ASSERT(reporter, SkAbs32(diff) <= 1);
-#endif
}
#endif
}