| 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 "SkIntersections.h" | 9 #include "SkIntersections.h" |
| 10 #include "SkPathOpsLine.h" | 10 #include "SkPathOpsLine.h" |
| 11 #include "SkPathOpsQuad.h" | 11 #include "SkPathOpsQuad.h" |
| 12 #include "SkReduceOrder.h" | 12 #include "SkReduceOrder.h" |
| 13 #include "TestClassDef.h" |
| 13 | 14 |
| 14 static int doIntersect(SkIntersections& intersections, const SkDQuad& quad, cons
t SkDLine& line, | 15 static int doIntersect(SkIntersections& intersections, const SkDQuad& quad, cons
t SkDLine& line, |
| 15 bool& flipped) { | 16 bool& flipped) { |
| 16 int result; | 17 int result; |
| 17 flipped = false; | 18 flipped = false; |
| 18 if (line[0].fX == line[1].fX) { | 19 if (line[0].fX == line[1].fX) { |
| 19 double top = line[0].fY; | 20 double top = line[0].fY; |
| 20 double bottom = line[1].fY; | 21 double bottom = line[1].fY; |
| 21 flipped = top > bottom; | 22 flipped = top > bottom; |
| 22 if (flipped) { | 23 if (flipped) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 testLineIntersect(state.fReporter, quad, line2, x, y); | 105 testLineIntersect(state.fReporter, quad, line2, x, y); |
| 105 state.fReporter->bumpTestCount(); | 106 state.fReporter->bumpTestCount(); |
| 106 SkDLine line3 = {{{x - h, y - v}, {x + h, y + v}}}; | 107 SkDLine line3 = {{{x - h, y - v}, {x + h, y + v}}}; |
| 107 testLineIntersect(state.fReporter, quad, line3, x, y); | 108 testLineIntersect(state.fReporter, quad, line3, x, y); |
| 108 state.fReporter->bumpTestCount(); | 109 state.fReporter->bumpTestCount(); |
| 109 } | 110 } |
| 110 } | 111 } |
| 111 } | 112 } |
| 112 } | 113 } |
| 113 | 114 |
| 114 static void PathOpsQuadLineIntersectionThreadedTest(skiatest::Reporter* reporter
) | 115 DEF_TEST(PathOpsQuadLineIntersectionThreaded, reporter) { |
| 115 { | |
| 116 int threadCount = initializeTests(reporter, "testQuadLineIntersect"); | 116 int threadCount = initializeTests(reporter, "testQuadLineIntersect"); |
| 117 PathOpsThreadedTestRunner testRunner(reporter, threadCount); | 117 PathOpsThreadedTestRunner testRunner(reporter, threadCount); |
| 118 for (int a = 0; a < 16; ++a) { | 118 for (int a = 0; a < 16; ++a) { |
| 119 for (int b = 0 ; b < 16; ++b) { | 119 for (int b = 0 ; b < 16; ++b) { |
| 120 for (int c = 0 ; c < 16; ++c) { | 120 for (int c = 0 ; c < 16; ++c) { |
| 121 *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreaded
Runnable, | 121 *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreaded
Runnable, |
| 122 (&testQuadLineIntersectMain, a, b, c, 0, &testRunner
)); | 122 (&testQuadLineIntersectMain, a, b, c, 0, &testRunner
)); |
| 123 } | 123 } |
| 124 if (!reporter->allowExtendedTest()) goto finish; | 124 if (!reporter->allowExtendedTest()) goto finish; |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 finish: | 127 finish: |
| 128 testRunner.render(); | 128 testRunner.render(); |
| 129 } | 129 } |
| 130 | |
| 131 #include "TestClassDef.h" | |
| 132 DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionThreadedTest) | |
| OLD | NEW |