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

Side by Side Diff: tests/PathOpsDebug.cpp

Issue 633393002: harden pathops for pathological test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: exclude new test that asserts in debug Created 6 years, 1 month 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/PathOpsBattles.cpp ('k') | tests/PathOpsExtendedTest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "SkOpContour.h" 1 #include "SkOpContour.h"
2 #include "SkIntersectionHelper.h" 2 #include "SkIntersectionHelper.h"
3 #include "SkOpSegment.h" 3 #include "SkOpSegment.h"
4 #include "SkString.h" 4 #include "SkString.h"
5 5
6 inline void DebugDumpDouble(double x) { 6 inline void DebugDumpDouble(double x) {
7 if (x == floor(x)) { 7 if (x == floor(x)) {
8 SkDebugf("%.0f", x); 8 SkDebugf("%.0f", x);
9 } else { 9 } else {
10 SkDebugf("%1.19g", x); 10 SkDebugf("%1.19g", x);
11 } 11 }
12 } 12 }
13 13
14 inline void DebugDumpFloat(float x) { 14 inline void DebugDumpFloat(float x) {
15 if (x == floorf(x)) { 15 if (x == floorf(x)) {
16 SkDebugf("%.0f", x); 16 SkDebugf("%.0f", x);
17 } else { 17 } else {
18 SkDebugf("%1.9gf", x); 18 SkDebugf("%1.9gf", x);
19 } 19 }
20 } 20 }
21 21
22 inline void DebugDumpHexFloat(float x) {
23 SkDebugf("SkBits2Float(0x%08x)", SkFloat2Bits(x));
24 }
22 25
23 #if DEBUG_SHOW_TEST_NAME 26 #if DEBUG_SHOW_TEST_NAME
24 27
25 static void output_scalar(SkScalar num) { 28 static void output_scalar(SkScalar num) {
26 if (num == (int) num) { 29 if (num == (int) num) {
27 SkDebugf("%d", (int) num); 30 SkDebugf("%d", (int) num);
28 } else { 31 } else {
29 SkString str; 32 SkString str;
30 str.printf("%1.9g", num); 33 str.printf("%1.9g", num);
31 int width = (int) str.size(); 34 int width = (int) str.size();
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 } 409 }
407 410
408 void SkDPoint::Dump(const SkPoint& pt) { 411 void SkDPoint::Dump(const SkPoint& pt) {
409 SkDebugf("{"); 412 SkDebugf("{");
410 DebugDumpFloat(pt.fX); 413 DebugDumpFloat(pt.fX);
411 SkDebugf(", "); 414 SkDebugf(", ");
412 DebugDumpFloat(pt.fY); 415 DebugDumpFloat(pt.fY);
413 SkDebugf("}"); 416 SkDebugf("}");
414 } 417 }
415 418
419 void SkDPoint::DumpHex(const SkPoint& pt) {
420 SkDebugf("{");
421 DebugDumpHexFloat(pt.fX);
422 SkDebugf(", ");
423 DebugDumpHexFloat(pt.fY);
424 SkDebugf("}");
425 }
426
427 void SkDQuad::dump() const {
428 dumpComma("");
429 }
416 430
417 void SkDQuad::dumpComma(const char* comma) const { 431 void SkDQuad::dumpComma(const char* comma) const {
418 SkDebugf("{{"); 432 SkDebugf("{{");
419 int index = 0; 433 int index = 0;
420 do { 434 do {
421 fPts[index].dump(); 435 fPts[index].dump();
422 SkDebugf(", "); 436 SkDebugf(", ");
423 } while (++index < 2); 437 } while (++index < 2);
424 fPts[index].dump(); 438 fPts[index].dump();
425 SkDebugf("}}%s\n", comma ? comma : ""); 439 SkDebugf("}}%s\n", comma ? comma : "");
426 } 440 }
427 441
428 void SkDQuad::dump() const {
429 dumpComma("");
430 }
431
432 void SkIntersectionHelper::dump() const { 442 void SkIntersectionHelper::dump() const {
433 SkDPoint::Dump(pts()[0]); 443 SkDPoint::Dump(pts()[0]);
434 SkDPoint::Dump(pts()[1]); 444 SkDPoint::Dump(pts()[1]);
435 if (verb() >= SkPath::kQuad_Verb) { 445 if (verb() >= SkPath::kQuad_Verb) {
436 SkDPoint::Dump(pts()[2]); 446 SkDPoint::Dump(pts()[2]);
437 } 447 }
438 if (verb() >= SkPath::kCubic_Verb) { 448 if (verb() >= SkPath::kCubic_Verb) {
439 SkDPoint::Dump(pts()[3]); 449 SkDPoint::Dump(pts()[3]);
440 } 450 }
441 } 451 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID()); 495 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID());
486 int index = 0; 496 int index = 0;
487 do { 497 do {
488 SkDPoint::Dump(fPts[index]); 498 SkDPoint::Dump(fPts[index]);
489 SkDebugf(", "); 499 SkDebugf(", ");
490 } while (++index < last); 500 } while (++index < last);
491 SkDPoint::Dump(fPts[index]); 501 SkDPoint::Dump(fPts[index]);
492 SkDebugf("}}\n"); 502 SkDebugf("}}\n");
493 } 503 }
494 504
505 void SkOpSegment::dumpHexPts() const {
506 int last = SkPathOpsVerbToPoints(fVerb);
507 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID());
508 int index = 0;
509 do {
510 SkDPoint::DumpHex(fPts[index]);
511 SkDebugf(", ");
512 } while (++index < last);
513 SkDPoint::DumpHex(fPts[index]);
514 SkDebugf("}}\n");
515 }
516
495 void SkOpSegment::dumpDPts() const { 517 void SkOpSegment::dumpDPts() const {
496 int count = SkPathOpsVerbToPoints(fVerb); 518 int count = SkPathOpsVerbToPoints(fVerb);
497 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID()); 519 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID());
498 int index = 0; 520 int index = 0;
499 do { 521 do {
500 SkDPoint dPt = {fPts[index].fX, fPts[index].fY}; 522 SkDPoint dPt = {fPts[index].fX, fPts[index].fY};
501 dPt.dump(); 523 dPt.dump();
502 if (index != count) { 524 if (index != count) {
503 SkDebugf(", "); 525 SkDebugf(", ");
504 } 526 }
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 dumpTestCase(quad1, quad2, testNo); 888 dumpTestCase(quad1, quad2, testNo);
867 dumpTestTrailer(); 889 dumpTestTrailer();
868 dumpTestList(testNo, 0); 890 dumpTestList(testNo, 0);
869 SkDebugf("\n"); 891 SkDebugf("\n");
870 } 892 }
871 893
872 void DumpT(const SkDQuad& quad, double t) { 894 void DumpT(const SkDQuad& quad, double t) {
873 SkDLine line = {{quad.ptAtT(t), quad[0]}}; 895 SkDLine line = {{quad.ptAtT(t), quad[0]}};
874 line.dump(); 896 line.dump();
875 } 897 }
OLDNEW
« no previous file with comments | « tests/PathOpsBattles.cpp ('k') | tests/PathOpsExtendedTest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698