| 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 |
| 56 {{{441.853149, 308.209106}, {434.672272, 315.389984}, {424.516998, 315.389984}}}
, | 78 {{{441.853149, 308.209106}, {434.672272, 315.389984}, {424.516998, 315.389984}}}
, |
| 57 {{{385.207275, 334.241272}, {406.481598, 312.96698}, {436.567993, 312.96698}}}, | 79 {{{385.207275, 334.241272}, {406.481598, 312.96698}, {436.567993, 312.96698}}}, |
| 58 | 80 |
| 59 {{{-708.00779269310044, -154.36998607290101}, {-707.90560262312511, -154.3699860
7290101}, {-707.8333433370193, -154.44224536635932}}}, | 81 {{{-708.00779269310044, -154.36998607290101}, {-707.90560262312511, -154.3699860
7290101}, {-707.8333433370193, -154.44224536635932}}}, |
| 60 {{{-708.00779269310044, -154.61669472244046}, {-701.04513225634582, -128.8597073
4043804}, {505.58447265625, -504.9130859375}}}, | 82 {{{-708.00779269310044, -154.61669472244046}, {-701.04513225634582, -128.8597073
4043804}, {505.58447265625, -504.9130859375}}}, |
| 61 | 83 |
| 62 {{{164, -40}, {231.51681518554687, -40}, {279.25839233398438, 7.7416000366210938
}}}, | 84 {{{164, -40}, {231.51681518554687, -40}, {279.25839233398438, 7.7416000366210938
}}}, |
| 63 {{{279.25839233398438, 7.7416000366210938}, {275.2164306640625, 3.69964003562927
25}, {271.03286743164062, -5.3290705182007514e-015}}}, | 85 {{{279.25839233398438, 7.7416000366210938}, {275.2164306640625, 3.69964003562927
25}, {271.03286743164062, -5.3290705182007514e-015}}}, |
| 64 | 86 |
| 65 {{{2.9999997378517067, 1.9737872594345709}, {2.9999997432230918, 1.9739647181863
822}, {1.2414155459263587e-163, 5.2957833941332142e-315}}}, | 87 {{{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... |
| 282 tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.fY); | 304 tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.fY); |
| 283 REPORTER_ASSERT(reporter, 0); | 305 REPORTER_ASSERT(reporter, 0); |
| 284 } | 306 } |
| 285 #if ONE_OFF_DEBUG | 307 #if ONE_OFF_DEBUG |
| 286 SkDebugf("%s [%d][%d] t1=%1.9g (%1.9g, %1.9g) t2=%1.9g\n", __FUNCTION__, | 308 SkDebugf("%s [%d][%d] t1=%1.9g (%1.9g, %1.9g) t2=%1.9g\n", __FUNCTION__, |
| 287 outer, inner, tt1, xy1.fX, xy1.fY, tt2); | 309 outer, inner, tt1, xy1.fX, xy1.fY, tt2); |
| 288 #endif | 310 #endif |
| 289 } | 311 } |
| 290 } | 312 } |
| 291 | 313 |
| 292 DEF_TEST(PathOpsQuadIntersectionOneOff, reporter) { | |
| 293 oneOffTest1(reporter, 0, 1); | |
| 294 } | |
| 295 | |
| 296 static void oneOffTests(skiatest::Reporter* reporter) { | 314 static void oneOffTests(skiatest::Reporter* reporter) { |
| 297 for (size_t outer = 0; outer < testSetCount - 1; ++outer) { | 315 for (size_t outer = 0; outer < testSetCount - 1; ++outer) { |
| 298 for (size_t inner = outer + 1; inner < testSetCount; ++inner) { | 316 for (size_t inner = outer + 1; inner < testSetCount; ++inner) { |
| 299 oneOffTest1(reporter, outer, inner); | 317 oneOffTest1(reporter, outer, inner); |
| 300 } | 318 } |
| 301 } | 319 } |
| 302 } | 320 } |
| 303 | 321 |
| 304 static const SkDQuad coincidentTestSet[] = { | 322 static const SkDQuad coincidentTestSet[] = { |
| 305 #if 0 | 323 #if 0 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 331 REPORTER_ASSERT(reporter, pt1.approximatelyEqual(pt2)); | 349 REPORTER_ASSERT(reporter, pt1.approximatelyEqual(pt2)); |
| 332 } | 350 } |
| 333 } | 351 } |
| 334 | 352 |
| 335 static void coincidentTest(skiatest::Reporter* reporter) { | 353 static void coincidentTest(skiatest::Reporter* reporter) { |
| 336 for (int testIndex = 0; testIndex < coincidentTestSetCount - 1; testIndex +=
2) { | 354 for (int testIndex = 0; testIndex < coincidentTestSetCount - 1; testIndex +=
2) { |
| 337 coincidentTestOne(reporter, testIndex, testIndex + 1); | 355 coincidentTestOne(reporter, testIndex, testIndex + 1); |
| 338 } | 356 } |
| 339 } | 357 } |
| 340 | 358 |
| 341 DEF_TEST(PathOpsQuadIntersectionCoincidenceOneOff, reporter) { | |
| 342 coincidentTestOne(reporter, 0, 1); | |
| 343 } | |
| 344 | |
| 345 static int floatSign(double x) { | 359 static int floatSign(double x) { |
| 346 return x < 0 ? -1 : x > 0 ? 1 : 0; | 360 return x < 0 ? -1 : x > 0 ? 1 : 0; |
| 347 } | 361 } |
| 348 | 362 |
| 349 static const SkDQuad pointFinderTestSet[] = { | 363 static const SkDQuad pointFinderTestSet[] = { |
| 350
//>=0.633974464 0.633974
846 <= | 364
//>=0.633974464 0.633974
846 <= |
| 351 {{{1.2071879545809394, 0.82163474041730045}, {1.1534203513372994, 0.527908700699
30229}, | 365 {{{1.2071879545809394, 0.82163474041730045}, {1.1534203513372994, 0.527908700699
30229}, |
| 352 {1.0880000000000001, 0.29599999999999982}}}, //t=0.63155333662549329, 0
.80000000000000004 | 366 {1.0880000000000001, 0.29599999999999982}}}, //t=0.63155333662549329, 0
.80000000000000004 |
| 353 {{{1.2071879545809394, 0.82163474041730045}, {1.2065040319428038, 0.817667532591
19995}, | 367 {{{1.2071879545809394, 0.82163474041730045}, {1.2065040319428038, 0.817667532591
19995}, |
| 354 {1.2058123269101506, 0.81370135061854221}}}, //t=0.63155333662549329, 0
.6339049773632347 | 368 {1.2058123269101506, 0.81370135061854221}}}, //t=0.63155333662549329, 0
.6339049773632347 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 intersectionFinder(0, 1); | 519 intersectionFinder(0, 1); |
| 506 } | 520 } |
| 507 | 521 |
| 508 DEF_TEST(PathOpsQuadIntersection, reporter) { | 522 DEF_TEST(PathOpsQuadIntersection, reporter) { |
| 509 oneOffTests(reporter); | 523 oneOffTests(reporter); |
| 510 coincidentTest(reporter); | 524 coincidentTest(reporter); |
| 511 standardTestCases(reporter); | 525 standardTestCases(reporter); |
| 512 if (false) QuadraticIntersection_IntersectionFinder(); | 526 if (false) QuadraticIntersection_IntersectionFinder(); |
| 513 if (false) QuadraticIntersection_PointFinder(); | 527 if (false) QuadraticIntersection_PointFinder(); |
| 514 } | 528 } |
| 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 |