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 "PathOpsTestCommon.h" | 8 #include "PathOpsTestCommon.h" |
9 #include "SkIntersections.h" | 9 #include "SkIntersections.h" |
10 #include "SkPathOpsLine.h" | 10 #include "SkPathOpsLine.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 intersections.intersect(quad, line); | 52 intersections.intersect(quad, line); |
53 result = intersections.used(); | 53 result = intersections.used(); |
54 } | 54 } |
55 return result; | 55 return result; |
56 } | 56 } |
57 | 57 |
58 static struct oneLineQuad { | 58 static struct oneLineQuad { |
59 SkDQuad quad; | 59 SkDQuad quad; |
60 SkDLine line; | 60 SkDLine line; |
61 } oneOffs[] = { | 61 } oneOffs[] = { |
| 62 {{{{447.96701049804687, 894.4381103515625}, {448.007080078125, 894.423950195
3125}, |
| 63 {448.0140380859375, 894.4215087890625}}}, |
| 64 {{{490.43548583984375, 879.40740966796875}, {405.59262084960937, 909.435546
875}}}}, |
62 {{{{142.589081, 102.283646}, {149.821579, 100}, {158, 100}}}, | 65 {{{{142.589081, 102.283646}, {149.821579, 100}, {158, 100}}}, |
63 {{{90, 230}, {160, 60}}}}, | 66 {{{90, 230}, {160, 60}}}}, |
64 {{{{1101, 10}, {1101, 8.3431453704833984}, {1099.828857421875, 7.17119979858
39844}}}, | 67 {{{{1101, 10}, {1101, 8.3431453704833984}, {1099.828857421875, 7.17119979858
39844}}}, |
65 {{{1099.828857421875,7.1711711883544922}, {1099.121337890625,7.878678321
8383789}}}}, | 68 {{{1099.828857421875,7.1711711883544922}, {1099.121337890625,7.878678321
8383789}}}}, |
66 {{{{973, 507}, {973, 508.24264526367187}, {972.12158203125, 509.121612548828
12}}}, | 69 {{{{973, 507}, {973, 508.24264526367187}, {972.12158203125, 509.121612548828
12}}}, |
67 {{{930, 467}, {973, 510}}}}, | 70 {{{930, 467}, {973, 510}}}}, |
68 {{{{369.848602, 145.680267}, {382.360413, 121.298294}, {406.207703, 121.2982
94}}}, | 71 {{{{369.848602, 145.680267}, {382.360413, 121.298294}, {406.207703, 121.2982
94}}}, |
69 {{{406.207703, 121.298294}, {348.781738, 123.864815}}}}, | 72 {{{406.207703, 121.298294}, {348.781738, 123.864815}}}}, |
70 }; | 73 }; |
71 | 74 |
(...skipping 15 matching lines...) Expand all Loading... |
87 SkDPoint lineXY = line.ptAtT(lineT); | 90 SkDPoint lineXY = line.ptAtT(lineT); |
88 if (!quadXY.approximatelyEqual(lineXY)) { | 91 if (!quadXY.approximatelyEqual(lineXY)) { |
89 quadXY.approximatelyEqual(lineXY); | 92 quadXY.approximatelyEqual(lineXY); |
90 SkDebugf(""); | 93 SkDebugf(""); |
91 } | 94 } |
92 REPORTER_ASSERT(reporter, quadXY.approximatelyEqual(lineXY)); | 95 REPORTER_ASSERT(reporter, quadXY.approximatelyEqual(lineXY)); |
93 } | 96 } |
94 } | 97 } |
95 } | 98 } |
96 | 99 |
97 static void PathOpsQuadLineIntersectionTestOne(skiatest::Reporter* reporter) { | 100 static void PathOpsQuadLineIntersectionOneOffTest(skiatest::Reporter* reporter)
{ |
98 testOneOffs(reporter); | 101 testOneOffs(reporter); |
99 } | 102 } |
100 | 103 |
101 static void PathOpsQuadLineIntersectionTest(skiatest::Reporter* reporter) { | 104 static void PathOpsQuadLineIntersectionTest(skiatest::Reporter* reporter) { |
102 for (size_t index = 0; index < lineQuadTests_count; ++index) { | 105 for (size_t index = 0; index < lineQuadTests_count; ++index) { |
103 int iIndex = static_cast<int>(index); | 106 int iIndex = static_cast<int>(index); |
104 const SkDQuad& quad = lineQuadTests[index].quad; | 107 const SkDQuad& quad = lineQuadTests[index].quad; |
105 SkASSERT(ValidQuad(quad)); | 108 SkASSERT(ValidQuad(quad)); |
106 const SkDLine& line = lineQuadTests[index].line; | 109 const SkDLine& line = lineQuadTests[index].line; |
107 SkASSERT(ValidLine(line)); | 110 SkASSERT(ValidLine(line)); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 SkDebugf("%s t1=(%1.9g,%1.9g)\n", __FUNCTION__, t1.fX, t1.fY); | 144 SkDebugf("%s t1=(%1.9g,%1.9g)\n", __FUNCTION__, t1.fX, t1.fY); |
142 REPORTER_ASSERT(reporter, 0); | 145 REPORTER_ASSERT(reporter, 0); |
143 } | 146 } |
144 } | 147 } |
145 } | 148 } |
146 } | 149 } |
147 | 150 |
148 #include "TestClassDef.h" | 151 #include "TestClassDef.h" |
149 DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionTest) | 152 DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionTest) |
150 | 153 |
151 DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionTestOne) | 154 DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionOneOffTest) |
OLD | NEW |