Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: tests/PathOpsQuadIntersectionTest.cpp

Issue 1037953004: add conics to path ops (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: turn off pathops specific debuggging Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/PathOpsOpTest.cpp ('k') | tests/PathOpsSimplifyFailTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 {{{1, 1}, {0, 2}, {3, 3}}},
57 {{{3, 0}, {0, 1}, {1, 2}}},
58
59 {{{0.33333333333333326, 0.81481481481481488}, {0.63395173631977997, 0.6874413672 6313931}, {1.205684411948591, 0.81344322326274499}}},
60 {{{0.33333333333333326, 0.81481481481481488}, {0.63396444791444551, 0.6874336836 2444768}, {1.205732763658403, 0.81345617746834109}}},
61
56 {{{4981.9990234375, 1590}, {4981.9990234375, 1617.7523193359375}, {4962.375, 163 7.3760986328125}}}, 62 {{{4981.9990234375, 1590}, {4981.9990234375, 1617.7523193359375}, {4962.375, 163 7.3760986328125}}},
57 {{{4962.3759765625, 1637.3760986328125}, {4982, 1617.7523193359375}, {4982, 1590 }}}, 63 {{{4962.3759765625, 1637.3760986328125}, {4982, 1617.7523193359375}, {4982, 1590 }}},
58 64
59 {{{48.7416f, 7.74160004f}, {96.4831848f, -40}, {164, -40}}}, 65 {{{48.7416f, 7.74160004f}, {96.4831848f, -40}, {164, -40}}},
60 {{{56.9671326f, 0}, {52.7835083f, 3.69968891f}, {48.7416f, 7.74160004f}}}, 66 {{{56.9671326f, 0}, {52.7835083f, 3.69968891f}, {48.7416f, 7.74160004f}}},
61 67
62 {{{138, 80}, {147.15692138671875, 80}, {155.12803649902344, 82.86279296875}}}, 68 {{{138, 80}, {147.15692138671875, 80}, {155.12803649902344, 82.86279296875}}},
63 {{{155.12803649902344, 82.86279296875}, {153.14971923828125, 82.152290344238281} , {151.09841918945312, 81.618133544921875}}}, 69 {{{155.12803649902344, 82.86279296875}, {153.14971923828125, 82.152290344238281} , {151.09841918945312, 81.618133544921875}}},
64 70
65 {{{88, 130}, {88, 131.54483032226562}, {88.081489562988281, 133.0560302734375}}} , 71 {{{88, 130}, {88, 131.54483032226562}, {88.081489562988281, 133.0560302734375}}} ,
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 {{{8, 8}, {9, 9}, {10, 8}}} 320 {{{8, 8}, {9, 9}, {10, 8}}}
315 }; 321 };
316 322
317 const size_t testSetCount = SK_ARRAY_COUNT(testSet); 323 const size_t testSetCount = SK_ARRAY_COUNT(testSet);
318 324
319 static void oneOffTest1(skiatest::Reporter* reporter, size_t outer, size_t inner ) { 325 static void oneOffTest1(skiatest::Reporter* reporter, size_t outer, size_t inner ) {
320 const SkDQuad& quad1 = testSet[outer]; 326 const SkDQuad& quad1 = testSet[outer];
321 SkASSERT(ValidQuad(quad1)); 327 SkASSERT(ValidQuad(quad1));
322 const SkDQuad& quad2 = testSet[inner]; 328 const SkDQuad& quad2 = testSet[inner];
323 SkASSERT(ValidQuad(quad2)); 329 SkASSERT(ValidQuad(quad2));
324 SkIntersections intersections2; 330 SkIntersections intersections;
325 intersections2.intersect(quad1, quad2); 331 intersections.intersect(quad1, quad2);
326 for (int pt = 0; pt < intersections2.used(); ++pt) { 332 for (int pt = 0; pt < intersections.used(); ++pt) {
327 double tt1 = intersections2[0][pt]; 333 double tt1 = intersections[0][pt];
328 SkDPoint xy1 = quad1.ptAtT(tt1); 334 SkDPoint xy1 = quad1.ptAtT(tt1);
329 double tt2 = intersections2[1][pt]; 335 double tt2 = intersections[1][pt];
330 SkDPoint xy2 = quad2.ptAtT(tt2); 336 SkDPoint xy2 = quad2.ptAtT(tt2);
331 if (!xy1.approximatelyEqual(xy2)) { 337 if (!xy1.approximatelyEqual(xy2)) {
332 SkDebugf("%s [%d,%d] x!= t1=%g (%g,%g) t2=%g (%g,%g)\n", 338 SkDebugf("%s [%d,%d] x!= t1=%g (%g,%g) t2=%g (%g,%g)\n",
333 __FUNCTION__, static_cast<int>(outer), static_cast<int>(inne r), 339 __FUNCTION__, static_cast<int>(outer), static_cast<int>(inne r),
334 tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.fY); 340 tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.fY);
335 REPORTER_ASSERT(reporter, 0); 341 REPORTER_ASSERT(reporter, 0);
336 } 342 }
337 #if ONE_OFF_DEBUG 343 #if ONE_OFF_DEBUG
338 SkDebugf("%s [%d][%d] t1=%1.9g (%1.9g, %1.9g) t2=%1.9g\n", __FUNCTION__, 344 SkDebugf("%s [%d][%d] t1=%1.9g (%1.9g, %1.9g) t2=%1.9g\n", __FUNCTION__,
339 outer, inner, tt1, xy1.fX, xy1.fY, tt2); 345 outer, inner, tt1, xy1.fX, xy1.fY, tt2);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 SkDebugf("%s p2=(%1.9g,%1.9g)<(%1.9g,%1.9g)<(%1.9g,%1.9g)\n", __FUNCTION__, 550 SkDebugf("%s p2=(%1.9g,%1.9g)<(%1.9g,%1.9g)<(%1.9g,%1.9g)\n", __FUNCTION__,
545 p20.fX, p20.fY, p2Seed.fX, p2Seed.fY, p22.fX, p22.fY); 551 p20.fX, p20.fY, p2Seed.fX, p2Seed.fY, p22.fX, p22.fY);
546 #endif 552 #endif
547 } 553 }
548 554
549 static void QuadraticIntersection_IntersectionFinder() { 555 static void QuadraticIntersection_IntersectionFinder() {
550 intersectionFinder(0, 1); 556 intersectionFinder(0, 1);
551 } 557 }
552 558
553 DEF_TEST(PathOpsQuadIntersectionOneOff, reporter) { 559 DEF_TEST(PathOpsQuadIntersectionOneOff, reporter) {
554 oneOffTest1(reporter, 10, 11); 560 oneOffTest1(reporter, 0, 1);
555 } 561 }
556 562
557 DEF_TEST(PathOpsQuadIntersectionCoincidenceOneOff, reporter) { 563 DEF_TEST(PathOpsQuadIntersectionCoincidenceOneOff, reporter) {
558 coincidentTestOne(reporter, 0, 1); 564 coincidentTestOne(reporter, 0, 1);
559 } 565 }
560 566
561 DEF_TEST(PathOpsQuadIntersection, reporter) { 567 DEF_TEST(PathOpsQuadIntersection, reporter) {
562 oneOffTests(reporter); 568 oneOffTests(reporter);
563 coincidentTest(reporter); 569 coincidentTest(reporter);
564 standardTestCases(reporter); 570 standardTestCases(reporter);
(...skipping 22 matching lines...) Expand all
587 } 593 }
588 for (int x = 0; x < 100; ++x) { 594 for (int x = 0; x < 100; ++x) {
589 for (size_t test = 0; test < quadraticTests_count; ++test) { 595 for (size_t test = 0; test < quadraticTests_count; ++test) {
590 const SkDQuad& quad1 = quadraticTests[test][0]; 596 const SkDQuad& quad1 = quadraticTests[test][0];
591 const SkDQuad& quad2 = quadraticTests[test][1]; 597 const SkDQuad& quad2 = quadraticTests[test][1];
592 (void) intersections.intersect(quad1, quad2); 598 (void) intersections.intersect(quad1, quad2);
593 REPORTER_ASSERT(reporter, intersections.used() >= 0); // make sure code isn't tossed 599 REPORTER_ASSERT(reporter, intersections.used() >= 0); // make sure code isn't tossed
594 } 600 }
595 } 601 }
596 } 602 }
OLDNEW
« no previous file with comments | « tests/PathOpsOpTest.cpp ('k') | tests/PathOpsSimplifyFailTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698