increase SkPoint3 normalize precision
using sqrtf() instead of sqrt() loses
too much precision.
Removed SK_CPU_FLUSH_TO_ZERO since
it was only used by the older code.
R=robertphillips@google.com
Bug: skia:
Change-Id: Ief2b969642e7dd423a2b07d2158f5e24eb487ca7
Reviewed-on: https://skia-review.googlesource.com/150380
Reviewed-by: Cary Clark <caryclark@skia.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
diff --git a/tests/Point3Test.cpp b/tests/Point3Test.cpp
index 2dedd6b..d131007 100644
--- a/tests/Point3Test.cpp
+++ b/tests/Point3Test.cpp
@@ -8,6 +8,7 @@
// Unit tests for src/core/SkPoint3.cpp and its header
#include "SkPoint3.h"
+#include "SkRandom.h"
#include "Test.h"
static void test_eq_ops(skiatest::Reporter* reporter) {
@@ -104,6 +105,18 @@
REPORTER_ASSERT(reporter, SkScalarNearlyEqual(newLength, SK_Scalar1));
REPORTER_ASSERT(reporter, result);
}
+ SkRandom random;
+ random.setSeed(1234);
+ SkPoint3 pt3;
+ int testCount = 100000;
+ for (int index = 0; index < testCount; ++index) {
+ SkScalar testVal;
+ do {
+ testVal = random.nextRangeF(0, 2);
+ } while (!testVal);
+ pt3.set(testVal, 0, 0);
+ REPORTER_ASSERT(reporter, !pt3.normalize() || 1 == pt3.fX);
+ }
}
DEF_TEST(Point3, reporter) {