OLD | NEW |
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 } | |
25 | 22 |
26 #if DEBUG_SHOW_TEST_NAME | 23 #if DEBUG_SHOW_TEST_NAME |
27 | 24 |
28 static void output_scalar(SkScalar num) { | 25 static void output_scalar(SkScalar num) { |
29 if (num == (int) num) { | 26 if (num == (int) num) { |
30 SkDebugf("%d", (int) num); | 27 SkDebugf("%d", (int) num); |
31 } else { | 28 } else { |
32 SkString str; | 29 SkString str; |
33 str.printf("%1.9g", num); | 30 str.printf("%1.9g", num); |
34 int width = (int) str.size(); | 31 int width = (int) str.size(); |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } | 406 } |
410 | 407 |
411 void SkDPoint::Dump(const SkPoint& pt) { | 408 void SkDPoint::Dump(const SkPoint& pt) { |
412 SkDebugf("{"); | 409 SkDebugf("{"); |
413 DebugDumpFloat(pt.fX); | 410 DebugDumpFloat(pt.fX); |
414 SkDebugf(", "); | 411 SkDebugf(", "); |
415 DebugDumpFloat(pt.fY); | 412 DebugDumpFloat(pt.fY); |
416 SkDebugf("}"); | 413 SkDebugf("}"); |
417 } | 414 } |
418 | 415 |
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 } | |
430 | 416 |
431 void SkDQuad::dumpComma(const char* comma) const { | 417 void SkDQuad::dumpComma(const char* comma) const { |
432 SkDebugf("{{"); | 418 SkDebugf("{{"); |
433 int index = 0; | 419 int index = 0; |
434 do { | 420 do { |
435 fPts[index].dump(); | 421 fPts[index].dump(); |
436 SkDebugf(", "); | 422 SkDebugf(", "); |
437 } while (++index < 2); | 423 } while (++index < 2); |
438 fPts[index].dump(); | 424 fPts[index].dump(); |
439 SkDebugf("}}%s\n", comma ? comma : ""); | 425 SkDebugf("}}%s\n", comma ? comma : ""); |
440 } | 426 } |
441 | 427 |
| 428 void SkDQuad::dump() const { |
| 429 dumpComma(""); |
| 430 } |
| 431 |
442 void SkIntersectionHelper::dump() const { | 432 void SkIntersectionHelper::dump() const { |
443 SkDPoint::Dump(pts()[0]); | 433 SkDPoint::Dump(pts()[0]); |
444 SkDPoint::Dump(pts()[1]); | 434 SkDPoint::Dump(pts()[1]); |
445 if (verb() >= SkPath::kQuad_Verb) { | 435 if (verb() >= SkPath::kQuad_Verb) { |
446 SkDPoint::Dump(pts()[2]); | 436 SkDPoint::Dump(pts()[2]); |
447 } | 437 } |
448 if (verb() >= SkPath::kCubic_Verb) { | 438 if (verb() >= SkPath::kCubic_Verb) { |
449 SkDPoint::Dump(pts()[3]); | 439 SkDPoint::Dump(pts()[3]); |
450 } | 440 } |
451 } | 441 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID()); | 485 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID()); |
496 int index = 0; | 486 int index = 0; |
497 do { | 487 do { |
498 SkDPoint::Dump(fPts[index]); | 488 SkDPoint::Dump(fPts[index]); |
499 SkDebugf(", "); | 489 SkDebugf(", "); |
500 } while (++index < last); | 490 } while (++index < last); |
501 SkDPoint::Dump(fPts[index]); | 491 SkDPoint::Dump(fPts[index]); |
502 SkDebugf("}}\n"); | 492 SkDebugf("}}\n"); |
503 } | 493 } |
504 | 494 |
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 | |
517 void SkOpSegment::dumpDPts() const { | 495 void SkOpSegment::dumpDPts() const { |
518 int count = SkPathOpsVerbToPoints(fVerb); | 496 int count = SkPathOpsVerbToPoints(fVerb); |
519 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID()); | 497 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID()); |
520 int index = 0; | 498 int index = 0; |
521 do { | 499 do { |
522 SkDPoint dPt = {fPts[index].fX, fPts[index].fY}; | 500 SkDPoint dPt = {fPts[index].fX, fPts[index].fY}; |
523 dPt.dump(); | 501 dPt.dump(); |
524 if (index != count) { | 502 if (index != count) { |
525 SkDebugf(", "); | 503 SkDebugf(", "); |
526 } | 504 } |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 dumpTestCase(quad1, quad2, testNo); | 866 dumpTestCase(quad1, quad2, testNo); |
889 dumpTestTrailer(); | 867 dumpTestTrailer(); |
890 dumpTestList(testNo, 0); | 868 dumpTestList(testNo, 0); |
891 SkDebugf("\n"); | 869 SkDebugf("\n"); |
892 } | 870 } |
893 | 871 |
894 void DumpT(const SkDQuad& quad, double t) { | 872 void DumpT(const SkDQuad& quad, double t) { |
895 SkDLine line = {{quad.ptAtT(t), quad[0]}}; | 873 SkDLine line = {{quad.ptAtT(t), quad[0]}}; |
896 line.dump(); | 874 line.dump(); |
897 } | 875 } |
OLD | NEW |