| 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 "PathOpsQuadIntersectionTestData.h" | 7 #include "PathOpsQuadIntersectionTestData.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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 tt2, xy2.fX, xy2.fY); | 46 tt2, xy2.fX, xy2.fY); |
| 47 REPORTER_ASSERT(reporter, 0); | 47 REPORTER_ASSERT(reporter, 0); |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 static const SkDQuad testSet[] = { | 55 static const SkDQuad testSet[] = { |
| 56 {{{-37.3484879,10.0192947}, {-36.4966316,13.2140198}, {-38.1506348,16.0788383}}}
, | |
| 57 {{{-38.1462746,16.08918}, {-36.4904327,13.2193804}, {-37.3484879,10.0192947}}}, | |
| 58 | |
| 59 {{{-37.3513985,10.0082998}, {-36.4938011,13.2090998}, {-38.1506004,16.0788002}}}
, | |
| 60 {{{-37.3508987,10.0102997}, {-36.4930992,13.2110004}, {-38.1497993,16.0809002}}}
, | |
| 61 | |
| 62 {{{-37.3508987,10.0102997}, {-37.3510017,10.0098}, {-37.3512001,10.0093002}}}, | |
| 63 {{{-49.0778008,19.0097008}, {-38.2086983,6.80954981}, {-37.3508987,10.0102997}}}
, | |
| 64 | |
| 65 {{{SkBits2Float(0xc22423b2), SkBits2Float(0x40afae2c)}, | |
| 66 {SkBits2Float(0xc2189b24), SkBits2Float(0x40e3f058)}, | |
| 67 {SkBits2Float(0xc21511d9), SkBits2Float(0x41251125)}}}, | |
| 68 {{{SkBits2Float(0xc2153d2f), SkBits2Float(0x412299db)}, | |
| 69 {SkBits2Float(0xc2153265), SkBits2Float(0x41233845)}, | |
| 70 {SkBits2Float(0xc21527fc), SkBits2Float(0x4123d684)}}}, | |
| 71 | |
| 72 {{{-37.3097496, 10.1625624}, {-37.2992134, 10.2012377}, {-37.2890472, 10.239872}
}}, | |
| 73 {{{-41.0348587, 5.49001122}, {-38.1515045, 7.12308884}, {-37.2674294, 10.3166857
}}}, | |
| 74 | |
| 75 {{{-52.8062439,14.1493912}, {-53.6638947,10.948595}, {-52.0070419,8.07883835}}}, | |
| 76 {{{-52.8054848,14.1522331}, {-53.6633072,10.9514809}, {-52.0066071,8.08163643}}}
, | |
| 77 | |
| 78 {{{441.853149, 308.209106}, {434.672272, 315.389984}, {424.516998, 315.389984}}}
, | 56 {{{441.853149, 308.209106}, {434.672272, 315.389984}, {424.516998, 315.389984}}}
, |
| 79 {{{385.207275, 334.241272}, {406.481598, 312.96698}, {436.567993, 312.96698}}}, | 57 {{{385.207275, 334.241272}, {406.481598, 312.96698}, {436.567993, 312.96698}}}, |
| 80 | 58 |
| 81 {{{-708.00779269310044, -154.36998607290101}, {-707.90560262312511, -154.3699860
7290101}, {-707.8333433370193, -154.44224536635932}}}, | 59 {{{-708.00779269310044, -154.36998607290101}, {-707.90560262312511, -154.3699860
7290101}, {-707.8333433370193, -154.44224536635932}}}, |
| 82 {{{-708.00779269310044, -154.61669472244046}, {-701.04513225634582, -128.8597073
4043804}, {505.58447265625, -504.9130859375}}}, | 60 {{{-708.00779269310044, -154.61669472244046}, {-701.04513225634582, -128.8597073
4043804}, {505.58447265625, -504.9130859375}}}, |
| 83 | 61 |
| 84 {{{164, -40}, {231.51681518554687, -40}, {279.25839233398438, 7.7416000366210938
}}}, | 62 {{{164, -40}, {231.51681518554687, -40}, {279.25839233398438, 7.7416000366210938
}}}, |
| 85 {{{279.25839233398438, 7.7416000366210938}, {275.2164306640625, 3.69964003562927
25}, {271.03286743164062, -5.3290705182007514e-015}}}, | 63 {{{279.25839233398438, 7.7416000366210938}, {275.2164306640625, 3.69964003562927
25}, {271.03286743164062, -5.3290705182007514e-015}}}, |
| 86 | 64 |
| 87 {{{2.9999997378517067, 1.9737872594345709}, {2.9999997432230918, 1.9739647181863
822}, {1.2414155459263587e-163, 5.2957833941332142e-315}}}, | 65 {{{2.9999997378517067, 1.9737872594345709}, {2.9999997432230918, 1.9739647181863
822}, {1.2414155459263587e-163, 5.2957833941332142e-315}}}, |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.fY); | 282 tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.fY); |
| 305 REPORTER_ASSERT(reporter, 0); | 283 REPORTER_ASSERT(reporter, 0); |
| 306 } | 284 } |
| 307 #if ONE_OFF_DEBUG | 285 #if ONE_OFF_DEBUG |
| 308 SkDebugf("%s [%d][%d] t1=%1.9g (%1.9g, %1.9g) t2=%1.9g\n", __FUNCTION__, | 286 SkDebugf("%s [%d][%d] t1=%1.9g (%1.9g, %1.9g) t2=%1.9g\n", __FUNCTION__, |
| 309 outer, inner, tt1, xy1.fX, xy1.fY, tt2); | 287 outer, inner, tt1, xy1.fX, xy1.fY, tt2); |
| 310 #endif | 288 #endif |
| 311 } | 289 } |
| 312 } | 290 } |
| 313 | 291 |
| 292 DEF_TEST(PathOpsQuadIntersectionOneOff, reporter) { |
| 293 oneOffTest1(reporter, 0, 1); |
| 294 } |
| 295 |
| 314 static void oneOffTests(skiatest::Reporter* reporter) { | 296 static void oneOffTests(skiatest::Reporter* reporter) { |
| 315 for (size_t outer = 0; outer < testSetCount - 1; ++outer) { | 297 for (size_t outer = 0; outer < testSetCount - 1; ++outer) { |
| 316 for (size_t inner = outer + 1; inner < testSetCount; ++inner) { | 298 for (size_t inner = outer + 1; inner < testSetCount; ++inner) { |
| 317 oneOffTest1(reporter, outer, inner); | 299 oneOffTest1(reporter, outer, inner); |
| 318 } | 300 } |
| 319 } | 301 } |
| 320 } | 302 } |
| 321 | 303 |
| 322 static const SkDQuad coincidentTestSet[] = { | 304 static const SkDQuad coincidentTestSet[] = { |
| 323 #if 0 | 305 #if 0 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 349 REPORTER_ASSERT(reporter, pt1.approximatelyEqual(pt2)); | 331 REPORTER_ASSERT(reporter, pt1.approximatelyEqual(pt2)); |
| 350 } | 332 } |
| 351 } | 333 } |
| 352 | 334 |
| 353 static void coincidentTest(skiatest::Reporter* reporter) { | 335 static void coincidentTest(skiatest::Reporter* reporter) { |
| 354 for (int testIndex = 0; testIndex < coincidentTestSetCount - 1; testIndex +=
2) { | 336 for (int testIndex = 0; testIndex < coincidentTestSetCount - 1; testIndex +=
2) { |
| 355 coincidentTestOne(reporter, testIndex, testIndex + 1); | 337 coincidentTestOne(reporter, testIndex, testIndex + 1); |
| 356 } | 338 } |
| 357 } | 339 } |
| 358 | 340 |
| 341 DEF_TEST(PathOpsQuadIntersectionCoincidenceOneOff, reporter) { |
| 342 coincidentTestOne(reporter, 0, 1); |
| 343 } |
| 344 |
| 359 static int floatSign(double x) { | 345 static int floatSign(double x) { |
| 360 return x < 0 ? -1 : x > 0 ? 1 : 0; | 346 return x < 0 ? -1 : x > 0 ? 1 : 0; |
| 361 } | 347 } |
| 362 | 348 |
| 363 static const SkDQuad pointFinderTestSet[] = { | 349 static const SkDQuad pointFinderTestSet[] = { |
| 364
//>=0.633974464 0.633974
846 <= | 350
//>=0.633974464 0.633974
846 <= |
| 365 {{{1.2071879545809394, 0.82163474041730045}, {1.1534203513372994, 0.527908700699
30229}, | 351 {{{1.2071879545809394, 0.82163474041730045}, {1.1534203513372994, 0.527908700699
30229}, |
| 366 {1.0880000000000001, 0.29599999999999982}}}, //t=0.63155333662549329, 0
.80000000000000004 | 352 {1.0880000000000001, 0.29599999999999982}}}, //t=0.63155333662549329, 0
.80000000000000004 |
| 367 {{{1.2071879545809394, 0.82163474041730045}, {1.2065040319428038, 0.817667532591
19995}, | 353 {{{1.2071879545809394, 0.82163474041730045}, {1.2065040319428038, 0.817667532591
19995}, |
| 368 {1.2058123269101506, 0.81370135061854221}}}, //t=0.63155333662549329, 0
.6339049773632347 | 354 {1.2058123269101506, 0.81370135061854221}}}, //t=0.63155333662549329, 0
.6339049773632347 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 intersectionFinder(0, 1); | 505 intersectionFinder(0, 1); |
| 520 } | 506 } |
| 521 | 507 |
| 522 DEF_TEST(PathOpsQuadIntersection, reporter) { | 508 DEF_TEST(PathOpsQuadIntersection, reporter) { |
| 523 oneOffTests(reporter); | 509 oneOffTests(reporter); |
| 524 coincidentTest(reporter); | 510 coincidentTest(reporter); |
| 525 standardTestCases(reporter); | 511 standardTestCases(reporter); |
| 526 if (false) QuadraticIntersection_IntersectionFinder(); | 512 if (false) QuadraticIntersection_IntersectionFinder(); |
| 527 if (false) QuadraticIntersection_PointFinder(); | 513 if (false) QuadraticIntersection_PointFinder(); |
| 528 } | 514 } |
| 529 | |
| 530 DEF_TEST(PathOpsQuadIntersectionCoincidenceOneOff, reporter) { | |
| 531 coincidentTestOne(reporter, 0, 1); | |
| 532 } | |
| 533 | |
| 534 DEF_TEST(PathOpsQuadIntersectionOneOff, reporter) { | |
| 535 oneOffTest1(reporter, 0, 1); | |
| 536 } | |
| OLD | NEW |