| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #include "PathOpsExtendedTest.h" | 7 #include "PathOpsExtendedTest.h" |
| 8 #include "PathOpsThreadedCommon.h" | 8 #include "PathOpsThreadedCommon.h" |
| 9 #include "TestClassDef.h" |
| 9 | 10 |
| 10 static void testSimplifyTrianglesMain(PathOpsThreadState* data) { | 11 static void testSimplifyTrianglesMain(PathOpsThreadState* data) { |
| 11 SkASSERT(data); | 12 SkASSERT(data); |
| 12 PathOpsThreadState& state = *data; | 13 PathOpsThreadState& state = *data; |
| 13 char pathStr[1024]; | 14 char pathStr[1024]; |
| 14 bool progress = state.fReporter->verbose(); // FIXME: break out into its own
parameter? | 15 bool progress = state.fReporter->verbose(); // FIXME: break out into its own
parameter? |
| 15 if (progress) { | 16 if (progress) { |
| 16 sk_bzero(pathStr, sizeof(pathStr)); | 17 sk_bzero(pathStr, sizeof(pathStr)); |
| 17 } | 18 } |
| 18 state.fKey = "?"; | 19 state.fKey = "?"; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 if (progress) { | 66 if (progress) { |
| 66 outputProgress(state.fPathStr, pathStr, SkPath::kEvenOdd_Fil
lType); | 67 outputProgress(state.fPathStr, pathStr, SkPath::kEvenOdd_Fil
lType); |
| 67 } | 68 } |
| 68 ShowTestName(&state, d, e, f, 1); | 69 ShowTestName(&state, d, e, f, 1); |
| 69 testSimplify(path, true, out, state, pathStr); | 70 testSimplify(path, true, out, state, pathStr); |
| 70 } | 71 } |
| 71 } | 72 } |
| 72 } | 73 } |
| 73 } | 74 } |
| 74 | 75 |
| 75 static void PathOpsSimplifyTrianglesThreadedTest(skiatest::Reporter* reporter) { | 76 DEF_TEST(PathOpsSimplifyTrianglesThreaded, reporter) { |
| 76 int threadCount = initializeTests(reporter, "testTriangles"); | 77 int threadCount = initializeTests(reporter, "testTriangles"); |
| 77 PathOpsThreadedTestRunner testRunner(reporter, threadCount); | 78 PathOpsThreadedTestRunner testRunner(reporter, threadCount); |
| 78 for (int a = 0; a < 15; ++a) { | 79 for (int a = 0; a < 15; ++a) { |
| 79 int ax = a & 0x03; | 80 int ax = a & 0x03; |
| 80 int ay = a >> 2; | 81 int ay = a >> 2; |
| 81 for (int b = a + 1; b < 16; ++b) { | 82 for (int b = a + 1; b < 16; ++b) { |
| 82 int bx = b & 0x03; | 83 int bx = b & 0x03; |
| 83 int by = b >> 2; | 84 int by = b >> 2; |
| 84 for (int c = a + 1; c < 16; ++c) { | 85 for (int c = a + 1; c < 16; ++c) { |
| 85 if (b == c) { | 86 if (b == c) { |
| 86 continue; | 87 continue; |
| 87 } | 88 } |
| 88 int cx = c & 0x03; | 89 int cx = c & 0x03; |
| 89 int cy = c >> 2; | 90 int cy = c >> 2; |
| 90 if ((bx - ax) * (cy - ay) == (by - ay) * (cx - ax)) { | 91 if ((bx - ax) * (cy - ay) == (by - ay) * (cx - ax)) { |
| 91 continue; | 92 continue; |
| 92 } | 93 } |
| 93 *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunn
able, | 94 *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunn
able, |
| 94 (&testSimplifyTrianglesMain, a, b, c, 0, &testRunner)); | 95 (&testSimplifyTrianglesMain, a, b, c, 0, &testRunner)); |
| 95 } | 96 } |
| 96 if (!reporter->allowExtendedTest()) goto finish; | 97 if (!reporter->allowExtendedTest()) goto finish; |
| 97 } | 98 } |
| 98 } | 99 } |
| 99 finish: | 100 finish: |
| 100 testRunner.render(); | 101 testRunner.render(); |
| 101 } | 102 } |
| 102 | |
| 103 #include "TestClassDef.h" | |
| 104 DEFINE_TESTCLASS_SHORT(PathOpsSimplifyTrianglesThreadedTest) | |
| OLD | NEW |