path ops work in progress
authorcaryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 15 Apr 2013 19:13:59 +0000 (19:13 +0000)
committercaryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 15 Apr 2013 19:13:59 +0000 (19:13 +0000)
standardize tests
use SK_ARRAY_COUNT everywhere
debug why x87 differs from SIMD 64
various platform specific fixes

git-svn-id: http://skia.googlecode.com/svn/trunk@8689 2bbb7eff-a529-9590-31e7-b0007b416f81

43 files changed:
experimental/Intersection/op.htm
gyp/pathops_unittest.gyp
gyp/pathops_unittest.gypi
src/pathops/SkDCubicIntersection.cpp
src/pathops/SkDQuadIntersection.cpp
src/pathops/SkOpAngle.h
src/pathops/SkOpSegment.cpp
src/pathops/SkOpSegment.h
src/pathops/SkPathOpsDebug.h
src/pathops/SkPathOpsPoint.h
tests/PathOpsAngleTest.cpp [new file with mode: 0644]
tests/PathOpsBoundsTest.cpp
tests/PathOpsCubicIntersectionTest.cpp
tests/PathOpsCubicIntersectionTestData.cpp
tests/PathOpsCubicLineIntersectionTest.cpp
tests/PathOpsCubicReduceOrderTest.cpp
tests/PathOpsCubicToQuadsTest.cpp
tests/PathOpsDCubicTest.cpp
tests/PathOpsDLineTest.cpp
tests/PathOpsDPointTest.cpp
tests/PathOpsDQuadTest.cpp
tests/PathOpsDRectTest.cpp
tests/PathOpsDTriangleTest.cpp
tests/PathOpsDVectorTest.cpp
tests/PathOpsExtendedTest.cpp
tests/PathOpsLineIntersectionTest.cpp
tests/PathOpsLineParametetersTest.cpp
tests/PathOpsOpCubicThreadedTest.cpp
tests/PathOpsOpRectThreadedTest.cpp
tests/PathOpsOpTest.cpp
tests/PathOpsQuadIntersectionTest.cpp
tests/PathOpsQuadIntersectionTestData.cpp
tests/PathOpsQuadLineIntersectionTest.cpp
tests/PathOpsQuadLineIntersectionThreadedTest.cpp
tests/PathOpsQuadParameterizationTest.cpp
tests/PathOpsQuadReduceOrderTest.cpp
tests/PathOpsSimplifyDegenerateThreadedTest.cpp
tests/PathOpsSimplifyQuadThreadedTest.cpp
tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp
tests/PathOpsSimplifyRectThreadedTest.cpp
tests/PathOpsSimplifyTest.cpp
tests/PathOpsSimplifyTrianglesThreadedTest.cpp
tests/TestClassDef.h

index 4c67e0a42044de591309c0ba471b6b0f7308750a..c7a64d837670d6bba2438ed0123603c78e79d6c3 100644 (file)
@@ -4078,11 +4078,55 @@ path.addRect(4, 13, 13, 16, SkPath::kCCW_Direction);
     pathB.close();
 </div>
 
+<div id="testQuadratic94">
+    SkPath path;
+    path.moveTo(0, 0);
+    path.lineTo(8, 8);
+    path.quadTo(8, 4, 4, 4);
+    path.quadTo(4, 0, 0, 0);
+    path.close();
+    testSimplify(reporter, path);
+</div>
+
+<div id="testQuadratic95">
+    SkPath path;
+    path.moveTo(8, 8);
+    path.lineTo(0, 0);
+    path.quadTo(4, 0, 4, 4);
+    path.quadTo(8, 4, 8, 8);
+    path.close();
+    testSimplify(reporter, path);
+</div>
+
+<div id="testQuadratic96">
+    SkPath path;
+    path.moveTo(8, 0);
+    path.lineTo(0, 8);
+    path.quadTo(0, 4, 4, 4);
+    path.quadTo(4, 0, 8, 0);
+    path.close();
+    testSimplify(reporter, path);
+</div>
+
+<div id="testQuadratic97">
+    SkPath path;
+    path.moveTo(0, 8);
+    path.lineTo(8, 0);
+    path.quadTo(4, 0, 4, 4);
+    path.quadTo(0, 4, 0, 8);
+    path.close();
+    testSimplify(reporter, path);
+</div>
+
 </div>
 
 <script type="text/javascript">
 
 var testDivs = [
+    testQuadratic97,
+    testQuadratic96,
+    testQuadratic95,
+    testQuadratic94,
     testLine16,
     cubicOp63d,
     cubicOp62d,
index 81d4c22834720849d8c18892323728bb3e2b6af3..2cb81724f010613e64bcaa506e030c6bb367c03f 100644 (file)
@@ -9,11 +9,9 @@
       'type': 'executable',
       'suppress_wildcard': '1',
       'include_dirs' : [
-        '../include/pathops',
         '../src/core',
         '../src/effects',
         '../src/lazy',
-        '../src/pathops',
         '../src/pdf',
         '../src/pipe/utils',
         '../src/utils',
index fb26c6a555df8932921611877f975a8bedaa0c64..ebe1d5b57499df4f53fa62be36c70e1baad8f046 100644 (file)
@@ -1,5 +1,6 @@
 {
   'sources': [
+    '../tests/PathOpsAngleTest.cpp',
     '../tests/PathOpsBoundsTest.cpp',
     '../tests/PathOpsCubicIntersectionTest.cpp',
     '../tests/PathOpsCubicIntersectionTestData.cpp',
index a31b1a4c5271cc78558c161df143dd44706f4bb8..f9d8cd55359d441d8d46dbbe7882251d0e870f44 100644 (file)
@@ -101,8 +101,6 @@ static void intersect(const SkDCubic& cubic1, double t1s, double t1e, const SkDC
             char tab[] = "                  ";
             if (tLimits1[0][0] >= t1Start && tLimits1[0][1] <= t1
                     && tLimits1[1][0] >= t2Start && tLimits1[1][1] <= t2) {
-                SkDCubic cSub1 = cubic1.subDivide(t1Start, t1);
-                SkDCubic cSub2 = cubic2.subDivide(t2Start, t2);
                 SkDebugf("%.*s %s t1=(%1.9g,%1.9g) t2=(%1.9g,%1.9g)", i.depth()*2, tab,
                         __FUNCTION__, t1Start, t1, t2Start, t2);
                 SkIntersections xlocals;
index d8e3f20a284b9bc5ac060a82eed1c1a082aec145..db4e2facff288f7c4dc5bca384c6eb5cc1026d18 100644 (file)
@@ -96,6 +96,9 @@ static bool only_end_pts_in_common(const SkDQuad& q1, const SkDQuad& q2, SkInter
         }
         for (int n = 0; n < 3; ++n) {
             double test = (q2[n].fY - origY) * adj - (q2[n].fX - origX) * opp;
+            if (test * sign > 0 && precisely_zero(test)) {
+                SkDebugf("*** very teeny\n");
+            }
             if (test * sign > 0) {
                 goto tryNextHalfPlane;
             }
@@ -151,7 +154,7 @@ static bool is_linear_inner(const SkDQuad& q1, double t1s, double t1e, const SkD
     SkDQuad hull = q1.subDivide(t1s, t1e);
     SkDLine line = {{hull[2], hull[0]}};
     const SkDLine* testLines[] = { &line, (const SkDLine*) &hull[0], (const SkDLine*) &hull[1] };
-    size_t testCount = sizeof(testLines) / sizeof(testLines[0]);
+    size_t testCount = SK_ARRAY_COUNT(testLines);
     SkTDArray<double> tsFound;
     for (size_t index = 0; index < testCount; ++index) {
         SkIntersections rootTs;
index d599dea7c2a9ae626016eb0ac49dcb9e60f49538..00520ecf439173ea6372d41bb885c2c38851eba9 100644 (file)
@@ -18,6 +18,7 @@
 class SkOpAngle {
 public:
     bool operator<(const SkOpAngle& rh) const;
+
     double dx() const {
         return fTangent1.dx();
     }
@@ -36,10 +37,12 @@ public:
 
     bool lengthen();
     bool reverseLengthen();
+
     void set(const SkPoint* orig, SkPath::Verb verb, const SkOpSegment* segment,
             int start, int end, const SkTDArray<SkOpSpan>& spans);
 
     void setSpans();
+
     SkOpSegment* segment() const {
         return const_cast<SkOpSegment*>(fSegment);
     }
index 79ecc662da947ad1ecacd09fe725bcd614d64c4f..30e78f5a0e693710e4edcf2eda8a4b3129b0ca22 100644 (file)
@@ -2663,7 +2663,7 @@ void SkOpSegment::debugShowSort(const char* fun, const SkTDArray<SkOpAngle*>& an
     int oppoSign = oppSign(firstAngle);
     int oppWindSum = oppLastSum - oppoSign;
     #define WIND_AS_STRING(x) char x##Str[12]; if (!valid_wind(x)) strcpy(x##Str, "?"); \
-        else snprintf(x##Str, sizeof(x##Str), "%d", x)
+        else SK_SNPRINTF(x##Str, sizeof(x##Str), "%d", x)
     WIND_AS_STRING(contourWinding);
     WIND_AS_STRING(oppContourWinding);
     SkDebugf("%s %s contourWinding=%s oppContourWinding=%s sign=%d\n", fun, __FUNCTION__,
@@ -2747,7 +2747,7 @@ void SkOpSegment::debugShowSort(const char* fun, const SkTDArray<SkOpAngle*>& an
                     opp ? windSumStr : oppWindSumStr);
         }
         SkDebugf(" done=%d tiny=%d opp=%d\n", mSpan.fDone, mSpan.fTiny, opp);
-#if false && DEBUG_ANGLE
+#if 0 && DEBUG_ANGLE
         angle.debugShow(segment.xyAtT(&sSpan));
 #endif
         ++index;
index dd51ab89e646d2c6015940962a38e98bc3b52841..f4f2aa56f2e9d608d628ef3d14a0a656c79cdeca 100644 (file)
@@ -151,6 +151,11 @@ public:
         return fTs[tIndex];
     }
 
+    // OPTIMIZATION: mark as debugging only if used solely by tests
+    const SkTDArray<SkOpSpan>& spans() const {
+        return fTs;
+    }
+
     int spanSign(const SkOpAngle* angle) const {
         SkASSERT(angle->segment() == this);
         return spanSign(angle->start(), angle->end());
index a642af4c011d4d45bb3fdf2aba14dc76c2d44d4c..065ba4b782c84cfc89008ee9620ba1ffe9b79e93 100644 (file)
@@ -12,7 +12,7 @@
 #ifdef SK_RELEASE
 #define FORCE_RELEASE 1
 #else
-#define FORCE_RELEASE 1  // set force release to 1 for multiple thread -- no debugging
+#define FORCE_RELEASE 0  // set force release to 1 for multiple thread -- no debugging
 #endif
 
 #define ONE_OFF_DEBUG 0
index 38051005eaba2de0e69320e3c9d525371316155d..713b45741844fcc5ed851b130a20348242a07b96 100644 (file)
@@ -108,7 +108,7 @@ struct SkDPoint {
 
     bool approximatelyEqual(const SkPoint& a) const {
         double denom = SkTMax<double>(fabs(fX), SkTMax<double>(fabs(fY),
-                SkScalarToDouble(SkTMax<SkScalar>(fabs(a.fX), fabs(a.fY)))));
+                SkScalarToDouble(SkTMax<SkScalar>(fabsf(a.fX), fabsf(a.fY)))));
         if (denom == 0) {
             return true;
         }
diff --git a/tests/PathOpsAngleTest.cpp b/tests/PathOpsAngleTest.cpp
new file mode 100644 (file)
index 0000000..e594bb6
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include "SkOpSegment.h"
+#include "Test.h"
+
+static const SkPoint cubics[][4] = {
+    {{0, 1}, {2, 6}, {4, 2}, {5, 3}}
+};
+
+static const SkPoint lines[][2] = {
+    {{6, 2}, {2, 4}}
+};
+
+struct SortSet {
+    const SkPoint* ptData;
+    int ptCount;
+    double tStart;
+    double tEnd;
+};
+
+static const SortSet set1[] = {
+    {lines[0], 2, 0.54070336, 0.388888889},
+    {cubics[0], 4, 0.666669871, 0.405037112},
+    {lines[0], 2, 0.54070336, 0.9140625},
+    {cubics[0], 4, 0.666669871, 0.875},
+};
+
+static const SortSet set2[] = {
+    {lines[0], 2, 0.574074074, 0.388888889},
+    {cubics[0], 4, 0.666666667, 0.405037112},
+    {lines[0], 2, 0.574074074, 0.9140625},
+    {cubics[0], 4, 0.666666667, 0.875},
+};
+
+struct SortSetTests {
+    const SortSet* set;
+    size_t count;
+};
+
+static const SortSetTests tests[] = {
+    { set1, SK_ARRAY_COUNT(set1) },
+    { set2, SK_ARRAY_COUNT(set2) }
+};
+
+static void setup(const SortSet* set, const size_t idx, SkPoint const ** data, 
+        SkPoint* reverse, SkOpSegment* seg) {
+    SkPoint start, end;
+    if (set[idx].ptCount == 2) {
+        if (set[idx].tStart < set[idx].tEnd) {
+            *data = set[idx].ptData;
+        } else {
+            reverse[0] = set[idx].ptData[1];
+            reverse[1] = set[idx].ptData[0];
+            *data = reverse;
+        }
+        seg->addLine(*data, false, false);
+        SkDLine dLine;
+        dLine.set(set[idx].ptData);
+        start = dLine.xyAtT(set[idx].tStart).asSkPoint();
+        end = dLine.xyAtT(set[idx].tEnd).asSkPoint();
+    } else if (set[idx].ptCount == 4) {
+        if (set[idx].tStart < set[idx].tEnd) {
+            *data = set[idx].ptData;
+        } else {
+            reverse[0] = set[idx].ptData[3];
+            reverse[1] = set[idx].ptData[2];
+            reverse[2] = set[idx].ptData[1];
+            reverse[3] = set[idx].ptData[0];
+            *data = reverse;
+        }
+        seg->addCubic(*data, false, false);
+        SkDCubic dCubic;
+        dCubic.set(set[idx].ptData);
+        start = dCubic.xyAtT(set[idx].tStart).asSkPoint();
+        end = dCubic.xyAtT(set[idx].tEnd).asSkPoint();
+    }
+    seg->addT(NULL, start, set[idx].tStart);
+    seg->addT(NULL, end, set[idx].tEnd);
+    seg->addT(NULL, set[idx].ptData[0], 0);
+    seg->addT(NULL, set[idx].ptData[set[idx].ptCount - 1], 1);
+}
+
+static void PathOpsAngleTest(skiatest::Reporter* reporter) {
+    for (size_t index = 0; index < SK_ARRAY_COUNT(tests); ++index) {
+        const SortSetTests& test = tests[index];
+        for (size_t idxL = 0; idxL < test.count - 1; ++idxL) {
+            SkOpSegment lesser, greater;
+            SkPoint lesserReverse[4], greaterReverse[4];
+            const SkPoint* lesserData, * greaterData;
+            const SortSet* set = test.set;
+            setup(set, idxL, &lesserData, lesserReverse, &lesser);
+            size_t idxG = idxL + 1;
+            setup(set, idxG, &greaterData, greaterReverse, &greater);
+            SkOpAngle first, second;
+            first.set(lesserData, (SkPath::Verb) (set[idxL].ptCount - 1), &lesser,
+                    0, 1, lesser.spans());
+            first.setSpans();
+            second.set(greaterData, (SkPath::Verb) (set[idxG].ptCount - 1), &greater,
+                    0, 1, greater.spans());
+            second.setSpans();
+            bool compare = first < second;
+            if (!compare) {
+                SkDebugf("%s test[%d]:  lesser[%d] > greater[%d]\n", __FUNCTION__,
+                        index, idxL,  idxG);
+            }
+            REPORTER_ASSERT(reporter, compare);
+        }
+    }
+}
+
+#include "TestClassDef.h"
+DEFINE_TESTCLASS_SHORT(PathOpsAngleTest)
index 0ed19540ed3e75fc5f5dc6a29a1e83bfc2203406..9d686a5de448b863890daf022b6ce074f460dcc7 100644 (file)
@@ -18,14 +18,14 @@ static const SkRect sectTests[][2] = {
     {{2, 0, 4, 1}, {4, 1, 5, 2}},  // touching just on a corner is OK
 };
 
-static const size_t sectTestsCount = sizeof(sectTests) / sizeof(sectTests[0]);
+static const size_t sectTestsCount = SK_ARRAY_COUNT(sectTests);
 
 static const SkRect noSectTests[][2] = {
     {{2, 0, 4, 1}, {5, 0, 6, 1}},
     {{2, 0, 4, 1}, {3, 2, 5, 2}},
 };
 
-static const size_t noSectTestsCount = sizeof(noSectTests) / sizeof(noSectTests[0]);
+static const size_t noSectTestsCount = SK_ARRAY_COUNT(noSectTests);
 
 static const SkRect reallyEmpty[] = {
     {0, 0, 0, 0},
@@ -35,7 +35,7 @@ static const SkRect reallyEmpty[] = {
     {1, 2, 3, SK_ScalarNaN},
 };
 
-static const size_t emptyTestsCount = sizeof(reallyEmpty) / sizeof(reallyEmpty[0]);
+static const size_t emptyTestsCount = SK_ARRAY_COUNT(reallyEmpty);
 
 static const SkRect notReallyEmpty[] = {
     {0, 0, 1, 0},
@@ -43,9 +43,9 @@ static const SkRect notReallyEmpty[] = {
     {0, 0, 1, 1},
 };
 
-static const size_t notEmptyTestsCount = sizeof(notReallyEmpty) / sizeof(notReallyEmpty[0]);
+static const size_t notEmptyTestsCount = SK_ARRAY_COUNT(notReallyEmpty);
 
-static void OpBoundsTest(skiatest::Reporter* reporter) {
+static void PathOpsBoundsTest(skiatest::Reporter* reporter) {
     for (size_t index = 0; index < sectTestsCount; ++index) {
         const SkPathOpsBounds& bounds1 = static_cast<const SkPathOpsBounds&>(sectTests[index][0]);
         const SkPathOpsBounds& bounds2 = static_cast<const SkPathOpsBounds&>(sectTests[index][1]);
@@ -103,4 +103,4 @@ static void OpBoundsTest(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsBounds", PathOpsBoundsClass, OpBoundsTest)
+DEFINE_TESTCLASS_SHORT(PathOpsBoundsTest)
index be9781dde65ef4aac3d719fd9de4ecafdc3260e8..f3db3c09092b2ca228eed81d4afd2d90976a6e74 100644 (file)
@@ -160,7 +160,7 @@ static const SkDCubic testSet[] = {
         {56.4860195, 60.529264}}},
 };
 
-const size_t testSetCount = sizeof(testSet) / sizeof(testSet[0]);
+const size_t testSetCount = SK_ARRAY_COUNT(testSet);
 
 static const SkDCubic newTestSet[] = {
 {{{0, 1}, {1, 5}, {1, 0}, {1, 0}}},
@@ -220,7 +220,7 @@ static const SkDCubic newTestSet[] = {
 {{{0, 3}, {0, 1}, {2, 0}, {1, 0}}},
 };
 
-const size_t newTestSetCount = sizeof(newTestSet) / sizeof(newTestSet[0]);
+const size_t newTestSetCount = SK_ARRAY_COUNT(newTestSet);
 
 static void oneOff(skiatest::Reporter* reporter, const SkDCubic& cubic1, const SkDCubic& cubic2) {
 #if ONE_OFF_DEBUG
@@ -463,7 +463,7 @@ static void cubicIntersectionSelfTest(skiatest::Reporter* reporter) {
         {{{6.71, 3.14}, {7.99, 2.75}, {8.27, 1.96}, {6.35, 3.57}}},
         {{{12.81, 7.27}, {7.22, 6.98}, {12.49, 8.97}, {11.42, 6.18}}},
     };
-    size_t selfSetCount = sizeof(selfSet) / sizeof(selfSet[0]);
+    size_t selfSetCount = SK_ARRAY_COUNT(selfSet);
     size_t firstFail = 1;
     for (size_t index = firstFail; index < selfSetCount; ++index) {
         const SkDCubic& cubic = selfSet[index];
@@ -500,7 +500,7 @@ static void cubicIntersectionSelfTest(skiatest::Reporter* reporter) {
     }
 }
 
-static void TestCubicIntersection(skiatest::Reporter* reporter) {
+static void PathOpsCubicIntersectionTest(skiatest::Reporter* reporter) {
     oneOffTest(reporter);
     oneOffTests(reporter);
     cubicIntersectionSelfTest(reporter);
@@ -510,4 +510,4 @@ static void TestCubicIntersection(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsCubicIntersectionTest", CubicIntersectionTestClass, TestCubicIntersection)
+DEFINE_TESTCLASS_SHORT(PathOpsCubicIntersectionTest)
index f4c0b4a3eda1d9da83fa743d9d0ba36f436e1e7f..1b1168be7f6dd450ea5890dec655d75ee1658c48 100644 (file)
@@ -41,7 +41,7 @@ const SkDCubic pointDegenerates[] = {
     {{{1, 1}, {2, 2}, {2, 2+N}, {1, 1}}},
 };
 
-const size_t pointDegenerates_count = sizeof(pointDegenerates) / sizeof(pointDegenerates[0]);
+const size_t pointDegenerates_count = SK_ARRAY_COUNT(pointDegenerates);
 
 const SkDCubic notPointDegenerates[] = {
     {{{1 + FLT_EPSILON * 2, 1}, {1, FLT_EPSILON * 2}, {1, 1}, {1, 1}}},
@@ -49,7 +49,7 @@ const SkDCubic notPointDegenerates[] = {
 };
 
 const size_t notPointDegenerates_count =
-        sizeof(notPointDegenerates) / sizeof(notPointDegenerates[0]);
+        SK_ARRAY_COUNT(notPointDegenerates);
 
 // from http://www.truetex.com/bezint.htm
 const SkDCubic tests[][2] = {
@@ -105,7 +105,7 @@ const SkDCubic tests[][2] = {
     }
 };
 
-const size_t tests_count = sizeof(tests) / sizeof(tests[0]);
+const size_t tests_count = SK_ARRAY_COUNT(tests);
 
 const SkDCubic lines[] = {
     {{{0, 0}, {0, 0}, {0, 0}, {1, 0}}},  // 0: horizontal
@@ -140,7 +140,7 @@ const SkDCubic lines[] = {
     {{{2, 2}, {4, 4}, {3, 3}, {1, 1}}},
 };
 
-const size_t lines_count = sizeof(lines) / sizeof(lines[0]);
+const size_t lines_count = SK_ARRAY_COUNT(lines);
 
 // 'not a line' tries to fool the line detection code
 const SkDCubic notLines[] = {
@@ -152,7 +152,7 @@ const SkDCubic notLines[] = {
     {{{0, 1}, {1, 0}, {0, 0}, {0, 0}}},
 };
 
-const size_t notLines_count = sizeof(notLines) / sizeof(notLines[0]);
+const size_t notLines_count = SK_ARRAY_COUNT(notLines);
 
 static const double E = FLT_EPSILON * 2;
 static const double F = FLT_EPSILON * 3;
@@ -198,7 +198,7 @@ const SkDCubic modEpsilonLines[] = {
     {{{2, 2}, {4, 4}, {3, 3}, {1, 1+E}}},
 };
 
-const size_t modEpsilonLines_count = sizeof(modEpsilonLines) / sizeof(modEpsilonLines[0]);
+const size_t modEpsilonLines_count = SK_ARRAY_COUNT(modEpsilonLines);
 
 const SkDCubic lessEpsilonLines[] = {
     {{{0, D}, {0, 0}, {0, 0}, {1, 0}}},  // horizontal
@@ -234,7 +234,7 @@ const SkDCubic lessEpsilonLines[] = {
     {{{2, 2}, {4, 4}, {3, 3}, {1, 1+D}}},
 };
 
-const size_t lessEpsilonLines_count = sizeof(lessEpsilonLines) / sizeof(lessEpsilonLines[0]);
+const size_t lessEpsilonLines_count = SK_ARRAY_COUNT(lessEpsilonLines);
 
 const SkDCubic negEpsilonLines[] = {
     {{{0, N}, {0, 0}, {0, 0}, {1, 0}}},  // horizontal
@@ -270,4 +270,4 @@ const SkDCubic negEpsilonLines[] = {
     {{{2, 2}, {4, 4}, {3, 3}, {1, 1+N}}},
 };
 
-const size_t negEpsilonLines_count = sizeof(negEpsilonLines) / sizeof(negEpsilonLines[0]);
+const size_t negEpsilonLines_count = SK_ARRAY_COUNT(negEpsilonLines);
index 874fff079d4f8de5f23e70735138b3e5b5bea053..7af7b26e458d3916424a66d0786989997fbc5a5d 100644 (file)
@@ -18,9 +18,9 @@ static struct lineCubic {
     {{{{0, 0}, {0, 1}, {0, 1}, {1, 1}}}, {{{0, 1}, {1, 0}}}},
 };
 
-static const size_t lineCubicTests_count = sizeof(lineCubicTests) / sizeof(lineCubicTests[0]);
+static const size_t lineCubicTests_count = SK_ARRAY_COUNT(lineCubicTests);
 
-static void CubicLineIntersectionTest(skiatest::Reporter* reporter) {
+static void PathOpsCubicLineIntersectionTest(skiatest::Reporter* reporter) {
     for (size_t index = 0; index < lineCubicTests_count; ++index) {
         int iIndex = static_cast<int>(index);
         const SkDCubic& cubic = lineCubicTests[index].cubic;
@@ -57,5 +57,4 @@ static void CubicLineIntersectionTest(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsCubicLineIntersection", CubicLineIntersectionTestClass, \
-        CubicLineIntersectionTest)
+DEFINE_TESTCLASS_SHORT(PathOpsCubicLineIntersectionTest)
index 25f6b2a475d4c6cc416717ba8c9d0d2d4019d544..d7518ab3039deb9366a96233562a7b62876743ed 100644 (file)
@@ -55,7 +55,7 @@ static void find_tight_bounds(const SkDCubic& cubic, SkDRect& bounds) {
     }
 }
 
-static void CubicReduceOrderTest(skiatest::Reporter* reporter) {
+static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
     size_t index;
     SkReduceOrder reducer;
     int order;
@@ -223,4 +223,4 @@ static void CubicReduceOrderTest(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsReduceOrderCubic", ReduceOrderCubicTestClass, CubicReduceOrderTest)
+DEFINE_TESTCLASS_SHORT(PathOpsReduceOrderCubicTest)
index 4d332fe42cb20f2f2672d83ffee0ac7e67302ac9..f18784fb547bb956f7368f23abd3af504d7258c7 100644 (file)
@@ -160,7 +160,7 @@ static SkDCubic locals[] = {
             {1.4974754310666936, 68.069569937917208}, {45.261946574441133, 17.536076632112298}}},
 };
 
-static size_t localsCount = sizeof(locals) / sizeof(locals[0]);
+static size_t localsCount = SK_ARRAY_COUNT(locals);
 
 #define DEBUG_CRASH 0
 #define TEST_AVERAGE_END_POINTS 0  // must take const off to test
@@ -192,11 +192,11 @@ static void CubicsToQuadratics_OneOffTest(skiatest::Reporter* reporter) {
     oneOff(reporter, 0);
 }
 
-static void TestCubicToQuads(skiatest::Reporter* reporter) {
+static void PathOpsCubicToQuadsTest(skiatest::Reporter* reporter) {
     CubicToQuads_Test(reporter);
     CubicsToQuadratics_OneOffTest(reporter);
     CubicsToQuadratics_OneOffTests(reporter);
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsCubicToQuads", PathOpsCubicToQuads, TestCubicToQuads)
+DEFINE_TESTCLASS_SHORT(PathOpsCubicToQuadsTest)
index 60b92dfa84a8dd994df950b6d05c3447d348b6dc..04850de8f6aa9c77f5af4e384068f6bef5b7b82d 100644 (file)
@@ -13,9 +13,9 @@ static const SkDCubic tests[] = {
     {{{3, 0}, {2, 1}, {3, 2}, {1, 1}}},
 };
 
-static const size_t tests_count = sizeof(tests) / sizeof(tests[0]);
+static const size_t tests_count = SK_ARRAY_COUNT(tests);
 
-static void DCubicTest(skiatest::Reporter* reporter) {
+static void PathOpsDCubicTest(skiatest::Reporter* reporter) {
     for (size_t index = 0; index < tests_count; ++index) {
         const SkDCubic& cubic = tests[index];
         bool result = cubic.clockwise();
@@ -27,4 +27,4 @@ static void DCubicTest(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsDCubic", PathOpsDCubic, DCubicTest)
+DEFINE_TESTCLASS_SHORT(PathOpsDCubicTest)
index 4108f70afdde16d69f5f658fa0c74bb5c28803d9..c23749416225d548c121c09b123e141b552b932b 100644 (file)
@@ -25,9 +25,9 @@ static const SkDPoint left[] = {
     {2, 1}
 };
 
-static const size_t tests_count = sizeof(tests) / sizeof(tests[0]);
+static const size_t tests_count = SK_ARRAY_COUNT(tests);
 
-static void DLineTest(skiatest::Reporter* reporter) {
+static void PathOpsLineUtilitiesTest(skiatest::Reporter* reporter) {
     for (size_t index = 0; index < tests_count; ++index) {
         const SkDLine& line = tests[index];
         SkDLine line2;
@@ -51,4 +51,4 @@ static void DLineTest(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsLineUtilities", PathOpsLineUtilitiesClass, DLineTest)
+DEFINE_TESTCLASS_SHORT(PathOpsLineUtilitiesTest)
index 551609be33d6ac7d1ac6a0d165fc0ada2aac995a..688d01b890bb34e5e9bd58b6358629b38a9f9822 100644 (file)
@@ -17,9 +17,9 @@ static const SkDPoint tests[] = {
     {2, 2}
 };
 
-static const size_t tests_count = sizeof(tests) / sizeof(tests[0]);
+static const size_t tests_count = SK_ARRAY_COUNT(tests);
 
-static void DPointTest(skiatest::Reporter* reporter) {
+static void PathOpsDPointTest(skiatest::Reporter* reporter) {
     for (size_t index = 0; index < tests_count; ++index) {
         const SkDPoint& pt = tests[index];
         SkDPoint p = pt;
@@ -47,4 +47,4 @@ static void DPointTest(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsDPoint", PathOpsDPointClass, DPointTest)
+DEFINE_TESTCLASS_SHORT(PathOpsDPointTest)
index f78e2aa3e2c0292d80b6ae2bb5949df8e180390e..89da6592668ad804e171a919b0ec4a1c527f01cd 100644 (file)
@@ -31,9 +31,9 @@ static const SkDPoint outPoint[]= {
     {1.1, 0.5},
 };
 
-static const size_t tests_count = sizeof(tests) / sizeof(tests[0]);
+static const size_t tests_count = SK_ARRAY_COUNT(tests);
 
-static void DQuadTest(skiatest::Reporter* reporter) {
+static void PathOpsDQuadTest(skiatest::Reporter* reporter) {
     for (size_t index = 0; index < tests_count; ++index) {
         const SkDQuad& quad = tests[index];
         bool result = quad.pointInHull(inPoint[index]);
@@ -50,4 +50,4 @@ static void DQuadTest(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsDQuad", PathOpsDQuadClass, DQuadTest)
+DEFINE_TESTCLASS_SHORT(PathOpsDQuadTest)
index 881ee0b86b448062a4e4d3421af6d56c5ab07edc..a053ac7f5cc8dc789d0613131325e67801dfb9e0 100644 (file)
@@ -33,11 +33,11 @@ static const SkDCubic cubicTests[] = {
     {{{3, 0}, {2, 1}, {3, 2}, {1, 1}}},
 };
 
-static const size_t lineTests_count = sizeof(lineTests) / sizeof(lineTests[0]);
-static const size_t quadTests_count = sizeof(quadTests) / sizeof(quadTests[0]);
-static const size_t cubicTests_count = sizeof(cubicTests) / sizeof(cubicTests[0]);
+static const size_t lineTests_count = SK_ARRAY_COUNT(lineTests);
+static const size_t quadTests_count = SK_ARRAY_COUNT(quadTests);
+static const size_t cubicTests_count = SK_ARRAY_COUNT(cubicTests);
 
-static void DRectTest(skiatest::Reporter* reporter) {
+static void PathOpsDRectTest(skiatest::Reporter* reporter) {
     size_t index;
     SkDRect rect, rect2;
     for (index = 0; index < lineTests_count; ++index) {
@@ -97,4 +97,4 @@ static void DRectTest(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsDRect", PathOpsDRectClass, DRectTest)
+DEFINE_TESTCLASS_SHORT(PathOpsDRectTest)
index 3ca797df38121a41d1394dccf59c6ce94bff1793..d64197df9dae9884ef781bdfe60251c7bea4362d 100644 (file)
@@ -25,9 +25,9 @@ static const SkDPoint outPoint[] = {
     {2.5, 2},
 };
 
-static const size_t tests_count = sizeof(tests) / sizeof(tests[0]);
+static const size_t tests_count = SK_ARRAY_COUNT(tests);
 
-static void TriangleUtilitiesTest(skiatest::Reporter* reporter) {
+static void PathOpsTriangleUtilitiesTest(skiatest::Reporter* reporter) {
     for (size_t index = 0; index < tests_count; ++index) {
         const SkDTriangle& triangle = tests[index];
         bool result = triangle.contains(inPoint[index]);
@@ -44,4 +44,4 @@ static void TriangleUtilitiesTest(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsTriangleUtilities", PathOpsTriangleUtilitiesClass, TriangleUtilitiesTest)
+DEFINE_TESTCLASS_SHORT(PathOpsTriangleUtilitiesTest)
index 48df753a065a50c6c412798902e4c013c76269ef..6d752c53880d07c0d1e7954b6525878478a1d57e 100644 (file)
@@ -17,9 +17,9 @@ static const SkDPoint tests[] = {
     {2, 2}
 };
 
-static const size_t tests_count = sizeof(tests) / sizeof(tests[0]);
+static const size_t tests_count = SK_ARRAY_COUNT(tests);
 
-static void DVectorTest(skiatest::Reporter* reporter) {
+static void PathOpsDVectorTest(skiatest::Reporter* reporter) {
     for (size_t index = 0; index < tests_count - 1; ++index) {
         SkDVector v1 = tests[index + 1] - tests[index];
         SkDVector v2 = tests[index] - tests[index + 1];
@@ -47,4 +47,4 @@ static void DVectorTest(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsDVector", PathOpsDVectorClass, DVectorTest)
+DEFINE_TESTCLASS_SHORT(PathOpsDVectorTest)
index 5aa1ac098c2ab5a21ce37a4c1a4c8c7a5a7e0194..ec8afb02a28852c2d6f0ba5ebcf81c2f8b26d592 100644 (file)
@@ -316,7 +316,7 @@ static int comparePaths(skiatest::Reporter* reporter, const SkPath& one, const S
 static void showPathOpPath(const SkPath& one, const SkPath& two, const SkPath& a, const SkPath& b,
         const SkPath& scaledOne, const SkPath& scaledTwo, const SkPathOp shapeOp,
         const SkMatrix& scale) {
-    SkASSERT((unsigned) shapeOp < sizeof(opStrs) / sizeof(opStrs[0]));
+    SkASSERT((unsigned) shapeOp < SK_ARRAY_COUNT(opStrs));
     showPath(a, "minuend:");
     SkDebugf("op: %s\n", opStrs[shapeOp]);
     showPath(b, "subtrahend:");
@@ -540,7 +540,7 @@ void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType pathFill
 
 void outputProgress(char* ramStr, const char* pathStr, SkPathOp op) {
     const char testFunction[] = "testOp(path);";
-    SkASSERT(op < sizeof(opSuffixes) / sizeof(opSuffixes[0]));
+    SkASSERT((size_t) op < SK_ARRAY_COUNT(opSuffixes));
     const char* nameSuffix = opSuffixes[op];
     SkMemoryWStream rRamStream(ramStr, PATH_STR_SIZE);
     outputToStream(pathStr, NULL, nameSuffix, testFunction, true, rRamStream);
index 5ab336e55f24327aeedc628fa89338bc3bcb797c..d0b5731fbd6939fa9e27030e9eb4d56ac6a3eb15 100644 (file)
@@ -19,7 +19,7 @@ static const SkDLine tests[][2] = {
      {{{166.86960700313026, 112.6965477747386}, {166.86925794355412, 112.69656471103423}}}}
 };
 
-static const size_t tests_count = sizeof(tests) / sizeof(tests[0]);
+static const size_t tests_count = SK_ARRAY_COUNT(tests);
 
 static const SkDLine noIntersect[][2] = {
     {{{{0, 0}, {1, 0}}}, {{{3, 0}, {2, 0}}}},
@@ -29,9 +29,9 @@ static const SkDLine noIntersect[][2] = {
     {{{{1, 1}, {2, 2}}}, {{{4, 4}, {3, 3}}}},
 };
 
-static const size_t noIntersect_count = sizeof(noIntersect) / sizeof(noIntersect[0]);
+static const size_t noIntersect_count = SK_ARRAY_COUNT(noIntersect);
 
-static void TestLineIntersection(skiatest::Reporter* reporter) {
+static void PathOpsLineIntersectionTest(skiatest::Reporter* reporter) {
     size_t index;
     for (index = 0; index < tests_count; ++index) {
         const SkDLine& line1 = tests[index][0];
@@ -58,4 +58,4 @@ static void TestLineIntersection(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsLineIntersection", LineIntersectionTestClass, TestLineIntersection)
+DEFINE_TESTCLASS_SHORT(PathOpsLineIntersectionTest)
index 2dad1b2e2cb3f9070c63ca6368e343cdc04ba370..0361e1aea67aa58936affe5e5abd2b7cce6b0541 100644 (file)
@@ -34,9 +34,9 @@ static const double answers[][2] = {
     {1.5894571940104115e-07, 7.9472859700520577e-08},
 };
 
-static const size_t tests_count = sizeof(tests) / sizeof(tests[0]);
+static const size_t tests_count = SK_ARRAY_COUNT(tests);
 
-static void LineParameterTest(skiatest::Reporter* reporter) {
+static void PathOpsLineParametersTest(skiatest::Reporter* reporter) {
     for (size_t index = 0; index < tests_count; ++index) {
         SkLineParameters lineParameters;
         const SkDCubic& cubic = tests[index];
@@ -77,4 +77,4 @@ static void LineParameterTest(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsLineParameters", PathOpsLineParametersClass, LineParameterTest)
+DEFINE_TESTCLASS_SHORT(PathOpsLineParametersTest)
index 31e8065470e2fd6bff6159dd1d5c579fa47b25fe..4197d766244b66acf2acd78e97c79f0c4f12f4f3 100644 (file)
@@ -57,7 +57,7 @@ static void testOpCubicsMain(PathOpsThreadState* data)
     }
 }
 
-static void TestOpCubicsThreaded(skiatest::Reporter* reporter)
+static void PathOpsOpCubicsThreadedTest(skiatest::Reporter* reporter)
 {
     int threadCount = initializeTests("cubicOp");
     PathOpsThreadedTestRunner testRunner(reporter, threadCount);
@@ -77,5 +77,4 @@ finish:
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsOpCubicsThreaded", OpCubicsThreadedTestClass, \
-        TestOpCubicsThreaded)
+DEFINE_TESTCLASS_SHORT(PathOpsOpCubicsThreadedTest)
index 6ac04cd4eb36fc7f9cf4bd4b8bf3c4cfcaab2b8f..e7aec8a432d53035f0fe8021d9afa597d45e2763 100644 (file)
@@ -66,7 +66,7 @@ static void testPathOpsRectsMain(PathOpsThreadState* data)
     }
 }
 
-static void TestPathOpsRectsThreaded(skiatest::Reporter* reporter) {
+static void PathOpsRectsThreadedTest(skiatest::Reporter* reporter) {
     int threadCount = initializeTests("testOp");
     PathOpsThreadedTestRunner testRunner(reporter, threadCount);
     for (int a = 0; a < 6; ++a) {  // outermost
@@ -85,5 +85,4 @@ finish:
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsRectsThreaded", OpRectsThreadedTestClass, \
-        TestPathOpsRectsThreaded)
+DEFINE_TESTCLASS_SHORT(PathOpsRectsThreadedTest)
index 97cd9e43fa3954279f3fa159fd09656251b4e426..4d7c621c3e3683ba6713b22327eff0ff58fdbd9f 100644 (file)
@@ -1190,7 +1190,7 @@ static struct TestDesc tests[] = {
     TEST(cubicOp1d),
 };
 
-static const size_t testCount = sizeof(tests) / sizeof(tests[0]);
+static const size_t testCount = SK_ARRAY_COUNT(tests);
 
 static struct TestDesc subTests[] = {
     TEST(cubicOp43d),
@@ -1210,7 +1210,7 @@ static struct TestDesc subTests[] = {
     TEST(cubicOp40d),
 };
 
-static const size_t subTestCount = sizeof(subTests) / sizeof(subTests[0]);
+static const size_t subTestCount = SK_ARRAY_COUNT(subTests);
 
 static void (*firstSubTest)(skiatest::Reporter* ) = 0;
 
@@ -1218,7 +1218,7 @@ static bool runSubTestsFirst = false;
 static bool runReverse = false;
 static void (*stopTest)(skiatest::Reporter* ) = 0;
 
-static void OpTest(skiatest::Reporter* reporter) {
+static void PathOpsOpTest(skiatest::Reporter* reporter) {
 #ifdef SK_DEBUG
     gDebugMaxWindSum = 4;
     gDebugMaxWindValue = 4;
@@ -1237,4 +1237,4 @@ static void OpTest(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsOpTest", PathOpsOpClass, OpTest)
+DEFINE_TESTCLASS_SHORT(PathOpsOpTest)
index 2ee70ec73583e0469a1e29c83c712ddbfc293c37..85555631df8e9fd4796cd3c5180b5e80ee038553 100644 (file)
@@ -226,7 +226,7 @@ static const SkDQuad testSet[] = {
     {{{8, 8}, {9, 9}, {10, 8}}}
 };
 
-const size_t testSetCount = sizeof(testSet) / sizeof(testSet[0]);
+const size_t testSetCount = SK_ARRAY_COUNT(testSet);
 
 static void oneOffTest1(skiatest::Reporter* reporter, size_t outer, size_t inner) {
     const SkDQuad& quad1 = testSet[outer];
@@ -271,7 +271,7 @@ static const SkDQuad coincidentTestSet[] = {
     {{{8, -10}, {10, 10}, {8, 8}}},
 };
 
-const size_t coincidentTestSetCount = sizeof(coincidentTestSet) / sizeof(coincidentTestSet[0]);
+const size_t coincidentTestSetCount = SK_ARRAY_COUNT(coincidentTestSet);
 
 static void coincidentTest(skiatest::Reporter* reporter) {
     for (size_t testIndex = 0; testIndex < coincidentTestSetCount - 1; testIndex += 2) {
@@ -453,7 +453,7 @@ static void QuadraticIntersection_IntersectionFinder() {
     intersectionFinder(0, 1);
 }
 
-static void TestQuadIntersection(skiatest::Reporter* reporter) {
+static void PathOpsQuadIntersectionTest(skiatest::Reporter* reporter) {
     oneOffTests(reporter);
     coincidentTest(reporter);
     standardTestCases(reporter);
@@ -464,4 +464,4 @@ static void TestQuadIntersection(skiatest::Reporter* reporter) {
 
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsQuadIntersection", QuadIntersectionTestClass, TestQuadIntersection)
+DEFINE_TESTCLASS_SHORT(PathOpsQuadIntersectionTest)
index 3c3bcdf4685310d402ad42786893e8d58cd3d4d1..0b0856117ba69d8e86e452c783444fc2fb754a93 100644 (file)
@@ -14,7 +14,7 @@ const SkDQuad quadraticPoints[] = {
     {{{1, 1}, {2, 2}, {1, 1}}},
 };
 
-const size_t quadraticPoints_count = sizeof(quadraticPoints) / sizeof(quadraticPoints[0]);
+const size_t quadraticPoints_count = SK_ARRAY_COUNT(quadraticPoints);
 
 const SkDQuad quadraticLines[] = {
     {{{0, 0}, {0, 0}, {1, 0}}},
@@ -42,7 +42,7 @@ const SkDQuad quadraticLines[] = {
     {{{2, 2}, {4, 4}, {3, 3}}},
 };
 
-const size_t quadraticLines_count = sizeof(quadraticLines) / sizeof(quadraticLines[0]);
+const size_t quadraticLines_count = SK_ARRAY_COUNT(quadraticLines);
 
 static const double F = FLT_EPSILON * 3;
 static const double H = FLT_EPSILON * 4;
@@ -80,7 +80,7 @@ const SkDQuad quadraticModEpsilonLines[] = {
 };
 
 const size_t quadraticModEpsilonLines_count =
-        sizeof(quadraticModEpsilonLines) / sizeof(quadraticModEpsilonLines[0]);
+        SK_ARRAY_COUNT(quadraticModEpsilonLines);
 
 const SkDQuad quadraticTests[][2] = {
     {  // one intersection
@@ -101,4 +101,4 @@ const SkDQuad quadraticTests[][2] = {
     }
 };
 
-const size_t quadraticTests_count = sizeof(quadraticTests) / sizeof(quadraticTests[0]);
+const size_t quadraticTests_count = SK_ARRAY_COUNT(quadraticTests);
index 09c28c1ceaabdf9ef8e1fc0525870192f3bff03a..37c8ef32681ed25ac303c56345d4eb5b361941e2 100644 (file)
@@ -25,7 +25,7 @@ static struct lineQuad {
     {{{{0, 0}, {0, 1}, {1, 1}}}, {{{0, 1}, {1, 0}}},  1,  {{.25, .75}, {0, 0}} },
 };
 
-static size_t lineQuadTests_count = sizeof(lineQuadTests) / sizeof(lineQuadTests[0]);
+static size_t lineQuadTests_count = SK_ARRAY_COUNT(lineQuadTests);
 
 static int doIntersect(SkIntersections& intersections, const SkDQuad& quad, const SkDLine& line,
                        bool& flipped) {
@@ -62,7 +62,7 @@ static struct oneLineQuad {
         {{{406.207703, 121.298294}, {348.781738, 123.864815}}}}
     };
 
-static size_t oneOffs_count = sizeof(oneOffs) / sizeof(oneOffs[0]);
+static size_t oneOffs_count = SK_ARRAY_COUNT(oneOffs);
 
 static void testOneOffs(skiatest::Reporter* reporter) {
     SkIntersections intersections;
@@ -81,7 +81,7 @@ static void testOneOffs(skiatest::Reporter* reporter) {
     }
 }
 
-static void TestQuadLineIntersection(skiatest::Reporter* reporter) {
+static void PathOpsQuadLineIntersectionTest(skiatest::Reporter* reporter) {
     testOneOffs(reporter);
     for (size_t index = 0; index < lineQuadTests_count; ++index) {
         int iIndex = static_cast<int>(index);
@@ -128,5 +128,4 @@ static void TestQuadLineIntersection(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsQuadLineIntersection", QuadLineIntersectionTestClass, \
-        TestQuadLineIntersection)
+DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionTest)
index a9312213451dd4f776d887f38f2c06b4572cf376..23adaf95e1c5414e08a12b34aa99e47adbf898a6 100644 (file)
@@ -111,7 +111,7 @@ static void testQuadLineIntersectMain(PathOpsThreadState* data)
     }
 }
 
-static void TestQuadLineIntersectionThreaded(skiatest::Reporter* reporter)
+static void PathOpsQuadLineIntersectionThreadedTest(skiatest::Reporter* reporter)
 {
     int threadCount = initializeTests("testQuadLineIntersect");
     PathOpsThreadedTestRunner testRunner(reporter, threadCount);
@@ -129,5 +129,4 @@ finish:
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsQuadLineIntersectionThreaded", QuadLineIntersectionThreadedTestClass, \
-        TestQuadLineIntersectionThreaded)
+DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionThreadedTest)
index 662871bb9e39e813a067cb59bc7cfa4ed20ef180..bb8ec2e636b4b60abbc7f50148a493925e003240 100644 (file)
@@ -24,9 +24,9 @@ static const SkDQuad quadratics[] = {
     {{{0, 0}, {1, 0}, {1, 1}}},
 };
 
-static const size_t quadratics_count = sizeof(quadratics) / sizeof(quadratics[0]);
+static const size_t quadratics_count = SK_ARRAY_COUNT(quadratics);
 
-static void TestQuadraticCoincidence(skiatest::Reporter* reporter) {
+static void PathOpsQuadImplicitTest(skiatest::Reporter* reporter) {
     // split large quadratic
     // compare original, parts, to see if the are coincident
     for (size_t index = 0; index < quadratics_count; ++index) {
@@ -36,7 +36,7 @@ static void TestQuadraticCoincidence(skiatest::Reporter* reporter) {
         const SkDQuad* quads[] = {
             &test, &midThird, &split.first(), &split.second()
         };
-        size_t quadsCount = sizeof(quads) / sizeof(quads[0]);
+        size_t quadsCount = SK_ARRAY_COUNT(quads);
         for (size_t one = 0; one < quadsCount; ++one) {
             for (size_t two = 0; two < quadsCount; ++two) {
                 for (size_t inner = 0; inner < 3; inner += 2) {
@@ -50,4 +50,4 @@ static void TestQuadraticCoincidence(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsQuadImplicit", QuadImplicitTestClass, TestQuadraticCoincidence)
+DEFINE_TESTCLASS_SHORT(PathOpsQuadImplicitTest)
index 64f2069e24d4293674302d961afc712c8293a50a..27cb5be6b840a56709d83fc016f5bf707a10214a 100644 (file)
@@ -15,7 +15,7 @@ static const SkDQuad testSet[] = {
     {{{1, 0}, {2, 6}, {3, 0}}}
 };
 
-static const size_t testSetCount = sizeof(testSet) / sizeof(testSet[0]);
+static const size_t testSetCount = SK_ARRAY_COUNT(testSet);
 
 static void oneOffTest(skiatest::Reporter* reporter) {
     for (size_t index = 0; index < testSetCount; ++index) {
@@ -62,10 +62,10 @@ static void standardTestCases(skiatest::Reporter* reporter) {
     }
 }
 
-static void QuadReduceOrderTest(skiatest::Reporter* reporter) {
+static void PathOpsReduceOrderQuadTest(skiatest::Reporter* reporter) {
     oneOffTest(reporter);
     standardTestCases(reporter);
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsReduceOrderQuad", ReduceOrderQuadTestClass, QuadReduceOrderTest)
+DEFINE_TESTCLASS_SHORT(PathOpsReduceOrderQuadTest)
index ea4ed0d2689ed3708b681897d26373356c2a295b..1c1f9cad62a3d013f685321ab566c057bab4809a 100755 (executable)
@@ -60,7 +60,7 @@ static void testSimplifyDegeneratesMain(PathOpsThreadState* data) {
     }
 }
 
-static void TestSimplifyDegeneratesThreaded(skiatest::Reporter* reporter) {
+static void PathOpsSimplifyDegeneratesThreadedTest(skiatest::Reporter* reporter) {
     int threadCount = initializeTests("testDegenerates");
     PathOpsThreadedTestRunner testRunner(reporter, threadCount);
     for (int a = 0; a < 16; ++a) {
@@ -85,5 +85,4 @@ finish:
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsSimplifyDegeneratesThreaded", SimplifyDegeneratesThreadedTestClass, \
-        TestSimplifyDegeneratesThreaded)
+DEFINE_TESTCLASS_SHORT(PathOpsSimplifyDegeneratesThreadedTest)
index 9343bc22437871425da3212a760fb2eaeb665a2e..0290602eeee88fc25bae6d990f1479b9416082dd 100644 (file)
@@ -66,7 +66,7 @@ static void testSimplifyQuadsMain(PathOpsThreadState* data)
     }
 }
 
-static void TestSimplifyQuadsThreaded(skiatest::Reporter* reporter)
+static void PathOpsSimplifyQuadsThreadedTest(skiatest::Reporter* reporter)
 {
     int threadCount = initializeTests("testQuads");
     PathOpsThreadedTestRunner testRunner(reporter, threadCount);
@@ -87,5 +87,4 @@ finish:
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsSimplifyQuadsThreaded", SimplifyQuadsThreadedTestClass, \
-        TestSimplifyQuadsThreaded)
+DEFINE_TESTCLASS_SHORT(PathOpsSimplifyQuadsThreadedTest)
index 93b3fe6f1ebaf487cb0c64ad66e6cf8bd6f7c29a..99cd79e556404b019fccef27cc528481dd7040b7 100755 (executable)
@@ -68,8 +68,7 @@ static void testSimplifyQuadralateralsMain(PathOpsThreadState* data)
     }
 }
 
-static void TestSimplifyQuadralateralsThreaded(skiatest::Reporter* reporter)
-{
+static void PathOpsSimplifyQuadralateralsThreadedTest(skiatest::Reporter* reporter) {
     int threadCount = initializeTests("testQuadralaterals");
     PathOpsThreadedTestRunner testRunner(reporter, threadCount);
     for (int a = 0; a < 16; ++a) {
@@ -88,5 +87,4 @@ finish:
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("SimplifyQuadralateralsThreaded", SimplifyQuadralateralsThreadedTestClass, \
-        TestSimplifyQuadralateralsThreaded)
+DEFINE_TESTCLASS_SHORT(PathOpsSimplifyQuadralateralsThreadedTest)
index bd8023cd8210c6f9ac2a1258f3060a66ea897305..33863cfe57b877ce6a738919058d2a73d7ca99be 100644 (file)
@@ -171,7 +171,7 @@ static void testSimplify4x4RectsMain(PathOpsThreadState* data)
     }
 }
 
-static void TestSimplifyRectsThreaded(skiatest::Reporter* reporter)
+static void PathOpsSimplifyRectsThreadedTest(skiatest::Reporter* reporter)
 {
     int threadCount = initializeTests("testLine");
     PathOpsThreadedTestRunner testRunner(reporter, threadCount);
@@ -191,5 +191,4 @@ finish:
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsSimplifyRectsThreaded",SimplifyRectsThreadedTestClass, \
-        TestSimplifyRectsThreaded)
+DEFINE_TESTCLASS_SHORT(PathOpsSimplifyRectsThreadedTest)
index 0da8da267fa5943615b6aadab13f8b47dd0a3726..e9133ef8ea9aa49b9f241e3306227ddcf75563d9 100644 (file)
@@ -3586,9 +3586,53 @@ static void testQuadralateral2(skiatest::Reporter* reporter) {
     testSimplify(reporter, path);
 }
 
+static void testQuadratic94(skiatest::Reporter* reporter) {
+    SkPath path;
+    path.moveTo(0, 0);
+    path.lineTo(8, 8);
+    path.quadTo(8, 4, 4, 4);
+    path.quadTo(4, 0, 0, 0);
+    path.close();
+    testSimplify(reporter, path);
+}
+
+static void testQuadratic95(skiatest::Reporter* reporter) {
+    SkPath path;
+    path.moveTo(8, 8);
+    path.lineTo(0, 0);
+    path.quadTo(4, 0, 4, 4);
+    path.quadTo(8, 4, 8, 8);
+    path.close();
+    testSimplify(reporter, path);
+}
+
+static void testQuadratic96(skiatest::Reporter* reporter) {
+    SkPath path;
+    path.moveTo(8, 0);
+    path.lineTo(0, 8);
+    path.quadTo(0, 4, 4, 4);
+    path.quadTo(4, 0, 8, 0);
+    path.close();
+    testSimplify(reporter, path);
+}
+
+static void testQuadratic97(skiatest::Reporter* reporter) {
+    SkPath path;
+    path.moveTo(0, 8);
+    path.lineTo(8, 0);
+    path.quadTo(4, 0, 4, 4);
+    path.quadTo(0, 4, 0, 8);
+    path.close();
+    testSimplify(reporter, path);
+}
+
 static void (*firstTest)(skiatest::Reporter* ) = 0;
 
 static TestDesc tests[] = {
+    TEST(testQuadratic97),
+    TEST(testQuadratic96),
+    TEST(testQuadratic95),
+    TEST(testQuadratic94),
     TEST(testQuadralateral2),
     TEST(testQuad1),  // FIXME: fails, need to investigate
     TEST(testCubic2),
@@ -3921,7 +3965,7 @@ static TestDesc tests[] = {
     TEST(testLine1),
 };
 
-static const size_t testCount = sizeof(tests) / sizeof(tests[0]);
+static const size_t testCount = SK_ARRAY_COUNT(tests);
 
 static TestDesc subTests[] = {
     TEST(testLine3),
@@ -3929,7 +3973,7 @@ static TestDesc subTests[] = {
     TEST(testLine1),
 };
 
-static const size_t subTestCount = sizeof(subTests) / sizeof(subTests[0]);
+static const size_t subTestCount = SK_ARRAY_COUNT(subTests);
 
 static void (*firstSubTest)(skiatest::Reporter* ) = 0;
 
@@ -3937,7 +3981,7 @@ static bool runSubTestsFirst = false;
 static bool runReverse = false;
 static void (*stopTest)(skiatest::Reporter* ) = 0;
 
-static void SimplifyTest(skiatest::Reporter* reporter) {
+static void PathOpsSimplifyTest(skiatest::Reporter* reporter) {
 #ifdef SK_DEBUG
     gDebugMaxWindSum = 4;
     gDebugMaxWindValue = 4;
@@ -3956,4 +4000,4 @@ static void SimplifyTest(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("PathOpsSimplifyTest", PathOpsSimplifyClass, SimplifyTest)
+DEFINE_TESTCLASS_SHORT(PathOpsSimplifyTest)
index ae72a723e6fd7b7ab3d2ace6383099b2d59716c9..4030a67a7bc725a284a179d14a7903a8544c53b1 100755 (executable)
@@ -62,7 +62,7 @@ static void testSimplifyTrianglesMain(PathOpsThreadState* data) {
     }
 }
 
-static void TestSimplifyTrianglesThreaded(skiatest::Reporter* reporter) {
+static void PathOpsSimplifyTrianglesThreadedTest(skiatest::Reporter* reporter) {
     int threadCount = initializeTests("testTriangles");
     PathOpsThreadedTestRunner testRunner(reporter, threadCount);
     for (int a = 0; a < 15; ++a) {
@@ -91,5 +91,4 @@ finish:
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("SimplifyTrianglesThreaded", SimplifyTrianglesThreadedTestClass, \
-        TestSimplifyTrianglesThreaded)
+DEFINE_TESTCLASS_SHORT(PathOpsSimplifyTrianglesThreadedTest)
index 4a7db4a33749277ff094f7a5d098e251f90db1ab..70d6039c16f38654293e569ed64645f722eaaab1 100644 (file)
         void MyTestFunction(skiatest::Reporter*)
 */
 
+// FIXME: replace all three param callers with the short one param version
+#define DEFINE_TESTCLASS_SHORT(function)                                                 \
+    namespace skiatest {                                                                 \
+        class function##Class : public Test {                                            \
+        public:                                                                          \
+            static Test* Factory(void*) { return SkNEW(function##Class); }               \
+        protected:                                                                       \
+            virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(#function); } \
+            virtual void onRun(Reporter* reporter) SK_OVERRIDE { function(reporter); }   \
+        };                                                                               \
+        static TestRegistry gReg_##function##Class(function##Class::Factory);            \
+    }
+
 #define DEFINE_TESTCLASS(uiname, classname, function)                                   \
     namespace skiatest {                                                                \
         class classname : public Test {                                                 \