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 "PathOpsCubicIntersectionTestData.h" | 7 #include "PathOpsCubicIntersectionTestData.h" |
8 #include "PathOpsTestCommon.h" | 8 #include "PathOpsTestCommon.h" |
9 #include "SkIntersections.h" | 9 #include "SkIntersections.h" |
10 #include "SkPathOpsRect.h" | 10 #include "SkPathOpsRect.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 static void oneOff(skiatest::Reporter* reporter, const SkDCubic& cubic1, const S
kDCubic& cubic2) { | 237 static void oneOff(skiatest::Reporter* reporter, const SkDCubic& cubic1, const S
kDCubic& cubic2) { |
238 #if ONE_OFF_DEBUG | 238 #if ONE_OFF_DEBUG |
239 SkDebugf("computed quadratics given\n"); | 239 SkDebugf("computed quadratics given\n"); |
240 SkDebugf(" {{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n"
, | 240 SkDebugf(" {{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n"
, |
241 cubic1[0].fX, cubic1[0].fY, cubic1[1].fX, cubic1[1].fY, | 241 cubic1[0].fX, cubic1[0].fY, cubic1[1].fX, cubic1[1].fY, |
242 cubic1[2].fX, cubic1[2].fY, cubic1[3].fX, cubic1[3].fY); | 242 cubic1[2].fX, cubic1[2].fY, cubic1[3].fX, cubic1[3].fY); |
243 SkDebugf(" {{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n"
, | 243 SkDebugf(" {{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n"
, |
244 cubic2[0].fX, cubic2[0].fY, cubic2[1].fX, cubic2[1].fY, | 244 cubic2[0].fX, cubic2[0].fY, cubic2[1].fX, cubic2[1].fY, |
245 cubic2[2].fX, cubic2[2].fY, cubic2[3].fX, cubic2[3].fY); | 245 cubic2[2].fX, cubic2[2].fY, cubic2[3].fX, cubic2[3].fY); |
246 #endif | 246 #endif |
247 SkTDArray<SkDQuad> quads1; | 247 SkTArray<SkDQuad, true> quads1; |
248 CubicToQuads(cubic1, cubic1.calcPrecision(), quads1); | 248 CubicToQuads(cubic1, cubic1.calcPrecision(), quads1); |
249 #if ONE_OFF_DEBUG | 249 #if ONE_OFF_DEBUG |
250 SkDebugf("computed quadratics set 1\n"); | 250 SkDebugf("computed quadratics set 1\n"); |
251 for (int index = 0; index < quads1.count(); ++index) { | 251 for (int index = 0; index < quads1.count(); ++index) { |
252 const SkDQuad& q = quads1[index]; | 252 const SkDQuad& q = quads1[index]; |
253 SkDebugf(" {{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", q[0].fX,
q[0].fY, | 253 SkDebugf(" {{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", q[0].fX,
q[0].fY, |
254 q[1].fX, q[1].fY, q[2].fX, q[2].fY); | 254 q[1].fX, q[1].fY, q[2].fX, q[2].fY); |
255 } | 255 } |
256 #endif | 256 #endif |
257 SkTDArray<SkDQuad> quads2; | 257 SkTArray<SkDQuad, true> quads2; |
258 CubicToQuads(cubic2, cubic2.calcPrecision(), quads2); | 258 CubicToQuads(cubic2, cubic2.calcPrecision(), quads2); |
259 #if ONE_OFF_DEBUG | 259 #if ONE_OFF_DEBUG |
260 SkDebugf("computed quadratics set 2\n"); | 260 SkDebugf("computed quadratics set 2\n"); |
261 for (int index = 0; index < quads2.count(); ++index) { | 261 for (int index = 0; index < quads2.count(); ++index) { |
262 const SkDQuad& q = quads2[index]; | 262 const SkDQuad& q = quads2[index]; |
263 SkDebugf(" {{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", q[0].fX,
q[0].fY, | 263 SkDebugf(" {{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", q[0].fX,
q[0].fY, |
264 q[1].fX, q[1].fY, q[2].fX, q[2].fY); | 264 q[1].fX, q[1].fY, q[2].fX, q[2].fY); |
265 } | 265 } |
266 #endif | 266 #endif |
267 SkIntersections intersections; | 267 SkIntersections intersections; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 oneOffTest(reporter); | 519 oneOffTest(reporter); |
520 oneOffTests(reporter); | 520 oneOffTests(reporter); |
521 cubicIntersectionSelfTest(reporter); | 521 cubicIntersectionSelfTest(reporter); |
522 standardTestCases(reporter); | 522 standardTestCases(reporter); |
523 if (false) CubicIntersection_IntersectionFinder(); | 523 if (false) CubicIntersection_IntersectionFinder(); |
524 if (false) CubicIntersection_RandTest(reporter); | 524 if (false) CubicIntersection_RandTest(reporter); |
525 } | 525 } |
526 | 526 |
527 #include "TestClassDef.h" | 527 #include "TestClassDef.h" |
528 DEFINE_TESTCLASS_SHORT(PathOpsCubicIntersectionTest) | 528 DEFINE_TESTCLASS_SHORT(PathOpsCubicIntersectionTest) |
OLD | NEW |