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" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 SkDPoint quadXY = quad.ptAtT(quadT); | 58 SkDPoint quadXY = quad.ptAtT(quadT); |
59 double lineT = intersections[1][index]; | 59 double lineT = intersections[1][index]; |
60 SkDPoint lineXY = line.ptAtT(lineT); | 60 SkDPoint lineXY = line.ptAtT(lineT); |
61 if (quadXY.approximatelyEqual(lineXY)) { | 61 if (quadXY.approximatelyEqual(lineXY)) { |
62 found = true; | 62 found = true; |
63 } | 63 } |
64 } | 64 } |
65 REPORTER_ASSERT(reporter, found); | 65 REPORTER_ASSERT(reporter, found); |
66 } | 66 } |
67 | 67 |
68 | |
69 // find a point on a quad by choosing a t from 0 to 1 | 68 // find a point on a quad by choosing a t from 0 to 1 |
70 // create a vertical span above and below the point | 69 // create a vertical span above and below the point |
71 // verify that intersecting the vertical span and the quad returns t | 70 // verify that intersecting the vertical span and the quad returns t |
72 // verify that a vertical span starting at quad[0] intersects at t=0 | 71 // verify that a vertical span starting at quad[0] intersects at t=0 |
73 // verify that a vertical span starting at quad[2] intersects at t=1 | 72 // verify that a vertical span starting at quad[2] intersects at t=1 |
74 static void testQuadLineIntersectMain(PathOpsThreadState* data) | 73 static void testQuadLineIntersectMain(PathOpsThreadState* data) |
75 { | 74 { |
76 PathOpsThreadState& state = *data; | 75 PathOpsThreadState& state = *data; |
77 REPORTER_ASSERT(state.fReporter, data); | 76 REPORTER_ASSERT(state.fReporter, data); |
78 int ax = state.fA & 0x03; | 77 int ax = state.fA & 0x03; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 for (int c = 0 ; c < 16; ++c) { | 118 for (int c = 0 ; c < 16; ++c) { |
120 *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreaded
Runnable, | 119 *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreaded
Runnable, |
121 (&testQuadLineIntersectMain, a, b, c, 0, &testRunner
)); | 120 (&testQuadLineIntersectMain, a, b, c, 0, &testRunner
)); |
122 } | 121 } |
123 if (!reporter->allowExtendedTest()) goto finish; | 122 if (!reporter->allowExtendedTest()) goto finish; |
124 } | 123 } |
125 } | 124 } |
126 finish: | 125 finish: |
127 testRunner.render(); | 126 testRunner.render(); |
128 } | 127 } |
OLD | NEW |