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 "PathOpsTestCommon.h" | 7 #include "PathOpsTestCommon.h" |
8 #include "SkIntersections.h" | 8 #include "SkIntersections.h" |
9 #include "SkPathOpsCubic.h" | 9 #include "SkPathOpsCubic.h" |
10 #include "SkPathOpsLine.h" | 10 #include "SkPathOpsLine.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 if (!xy1.approximatelyEqual(xy2)) { | 150 if (!xy1.approximatelyEqual(xy2)) { |
151 SkDebugf("%s [%d,%d] x!= t1=%g (%g,%g) t2=%g (%g,%g)\n", | 151 SkDebugf("%s [%d,%d] x!= t1=%g (%g,%g) t2=%g (%g,%g)\n", |
152 __FUNCTION__, iIndex, pt, tt1, xy1.fX, xy1.fY, tt2, xy2.fX,
xy2.fY); | 152 __FUNCTION__, iIndex, pt, tt1, xy1.fX, xy1.fY, tt2, xy2.fX,
xy2.fY); |
153 } | 153 } |
154 REPORTER_ASSERT(reporter, xy1.approximatelyEqual(xy2)); | 154 REPORTER_ASSERT(reporter, xy1.approximatelyEqual(xy2)); |
155 } | 155 } |
156 #if ONE_OFF_DEBUG | 156 #if ONE_OFF_DEBUG |
157 double cubicT = i[0][0]; | 157 double cubicT = i[0][0]; |
158 SkDPoint prev = cubic.ptAtT(cubicT * 2 - 1); | 158 SkDPoint prev = cubic.ptAtT(cubicT * 2 - 1); |
159 SkDPoint sect = cubic.ptAtT(cubicT); | 159 SkDPoint sect = cubic.ptAtT(cubicT); |
160 double left[3] = { line.isLeft(prev), line.isLeft(sect), line.isLeft(cub
ic[3]) }; | |
161 SkDebugf("cubic=(%1.9g, %1.9g, %1.9g)\n", left[0], left[1], left[2]); | |
162 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", prev.fX, prev.fY, sect.fX,
sect.fY); | 160 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", prev.fX, prev.fY, sect.fX,
sect.fY); |
163 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", sect.fX, sect.fY, cubic[3]
.fX, cubic[3].fY); | 161 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", sect.fX, sect.fY, cubic[3]
.fX, cubic[3].fY); |
164 SkDPoint prevL = line.ptAtT(i[1][0] - 0.0000007); | 162 SkDPoint prevL = line.ptAtT(i[1][0] - 0.0000007); |
165 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", prevL.fX, prevL.fY, i.pt(0
).fX, i.pt(0).fY); | 163 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", prevL.fX, prevL.fY, i.pt(0
).fX, i.pt(0).fY); |
166 SkDPoint nextL = line.ptAtT(i[1][0] + 0.0000007); | 164 SkDPoint nextL = line.ptAtT(i[1][0] + 0.0000007); |
167 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", i.pt(0).fX, i.pt(0).fY, ne
xtL.fX, nextL.fY); | 165 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", i.pt(0).fX, i.pt(0).fY, ne
xtL.fX, nextL.fY); |
168 SkDebugf("prevD=%1.9g dist=%1.9g nextD=%1.9g\n", prev.distance(nextL), | 166 SkDebugf("prevD=%1.9g dist=%1.9g nextD=%1.9g\n", prev.distance(nextL), |
169 sect.distance(i.pt(0)), cubic[3].distance(prevL)); | 167 sect.distance(i.pt(0)), cubic[3].distance(prevL)); |
170 #endif | 168 #endif |
171 } | 169 } |
(...skipping 17 matching lines...) Expand all Loading... |
189 | 187 |
190 DEF_TEST(PathOpsCubicLineIntersectionOneOff, reporter) { | 188 DEF_TEST(PathOpsCubicLineIntersectionOneOff, reporter) { |
191 int iIndex = 0; | 189 int iIndex = 0; |
192 testOne(reporter, iIndex); | 190 testOne(reporter, iIndex); |
193 const SkDCubic& cubic = lineCubicTests[iIndex].cubic; | 191 const SkDCubic& cubic = lineCubicTests[iIndex].cubic; |
194 const SkDLine& line = lineCubicTests[iIndex].line; | 192 const SkDLine& line = lineCubicTests[iIndex].line; |
195 SkIntersections i; | 193 SkIntersections i; |
196 i.intersect(cubic, line); | 194 i.intersect(cubic, line); |
197 SkASSERT(i.used() == 1); | 195 SkASSERT(i.used() == 1); |
198 } | 196 } |
OLD | NEW |