| 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 | 7 |
| 8 #include "PathOpsExtendedTest.h" | 8 #include "PathOpsExtendedTest.h" |
| 9 #include "PathOpsThreadedCommon.h" | 9 #include "PathOpsThreadedCommon.h" |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 SkBitmap bitmap; | 547 SkBitmap bitmap; |
| 548 int result = comparePaths(reporter, path, out, bitmap); | 548 int result = comparePaths(reporter, path, out, bitmap); |
| 549 if (result && gPathStrAssert) { | 549 if (result && gPathStrAssert) { |
| 550 REPORTER_ASSERT(reporter, 0); | 550 REPORTER_ASSERT(reporter, 0); |
| 551 } | 551 } |
| 552 reporter->bumpTestCount(); | 552 reporter->bumpTestCount(); |
| 553 return result == 0; | 553 return result == 0; |
| 554 } | 554 } |
| 555 | 555 |
| 556 #if DEBUG_SHOW_TEST_NAME | 556 #if DEBUG_SHOW_TEST_NAME |
| 557 void DebugShowPath(const SkPath& a, const SkPath& b, SkPathOp shapeOp, const cha
r* testName) { | 557 void SkPathOpsDebug::ShowPath(const SkPath& a, const SkPath& b, SkPathOp shapeOp
, |
| 558 ShowFunctionHeader(testName); | 558 const char* testName) { |
| 559 showPath(a, "path", true); | 559 ShowFunctionHeader(testName); |
| 560 showPath(b, "pathB", true); | 560 showPath(a, "path", true); |
| 561 ShowOp(shapeOp, "path", "pathB"); | 561 showPath(b, "pathB", true); |
| 562 ShowOp(shapeOp, "path", "pathB"); |
| 562 } | 563 } |
| 563 #endif | 564 #endif |
| 564 | 565 |
| 565 static bool innerPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkP
ath& b, | 566 static bool innerPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkP
ath& b, |
| 566 const SkPathOp shapeOp, const char* testName, bool threaded) { | 567 const SkPathOp shapeOp, const char* testName, bool threaded) { |
| 567 #if DEBUG_SHOW_TEST_NAME | 568 #if DEBUG_SHOW_TEST_NAME |
| 568 if (testName == NULL) { | 569 if (testName == NULL) { |
| 569 SkDebugf("\n"); | 570 SkDebugf("\n"); |
| 570 showPathData(a); | 571 showPathData(a); |
| 571 showOp(shapeOp); | 572 showOp(shapeOp); |
| 572 showPathData(b); | 573 showPathData(b); |
| 573 } else { | 574 } else { |
| 574 DebugShowPath(a, b, shapeOp, testName); | 575 SkPathOpsDebug::ShowPath(a, b, shapeOp, testName); |
| 575 } | 576 } |
| 576 #endif | 577 #endif |
| 577 SkPath out; | 578 SkPath out; |
| 578 if (!Op(a, b, shapeOp, &out) ) { | 579 if (!Op(a, b, shapeOp, &out) ) { |
| 579 SkDebugf("%s did not expect failure\n", __FUNCTION__); | 580 SkDebugf("%s did not expect failure\n", __FUNCTION__); |
| 580 REPORTER_ASSERT(reporter, 0); | 581 REPORTER_ASSERT(reporter, 0); |
| 581 return false; | 582 return false; |
| 582 } | 583 } |
| 583 if (threaded && !reporter->verbose()) { | 584 if (threaded && !reporter->verbose()) { |
| 584 return true; | 585 return true; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 return innerPathOp(reporter, a, b, shapeOp, testName, false); | 622 return innerPathOp(reporter, a, b, shapeOp, testName, false); |
| 622 } | 623 } |
| 623 | 624 |
| 624 bool testThreadedPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkP
ath& b, | 625 bool testThreadedPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkP
ath& b, |
| 625 const SkPathOp shapeOp, const char* testName) { | 626 const SkPathOp shapeOp, const char* testName) { |
| 626 return innerPathOp(reporter, a, b, shapeOp, testName, true); | 627 return innerPathOp(reporter, a, b, shapeOp, testName, true); |
| 627 } | 628 } |
| 628 | 629 |
| 629 int initializeTests(skiatest::Reporter* reporter, const char* test) { | 630 int initializeTests(skiatest::Reporter* reporter, const char* test) { |
| 630 #ifdef SK_DEBUG | 631 #ifdef SK_DEBUG |
| 631 gDebugMaxWindSum = 4; | 632 SkPathOpsDebug::gMaxWindSum = 4; |
| 632 gDebugMaxWindValue = 4; | 633 SkPathOpsDebug::gMaxWindValue = 4; |
| 633 #endif | 634 #endif |
| 634 testName = test; | 635 testName = test; |
| 635 size_t testNameSize = strlen(test); | 636 size_t testNameSize = strlen(test); |
| 636 SkFILEStream inFile("../../experimental/Intersection/op.htm"); | 637 SkFILEStream inFile("../../experimental/Intersection/op.htm"); |
| 637 if (inFile.isValid()) { | 638 if (inFile.isValid()) { |
| 638 SkTDArray<char> inData; | 639 SkTDArray<char> inData; |
| 639 inData.setCount(inFile.getLength()); | 640 inData.setCount(inFile.getLength()); |
| 640 size_t inLen = inData.count(); | 641 size_t inLen = inData.count(); |
| 641 inFile.read(inData.begin(), inLen); | 642 inFile.read(inData.begin(), inLen); |
| 642 inFile.setPath(NULL); | 643 inFile.setPath(NULL); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 } | 698 } |
| 698 if (tests[index].fun == stopTest) { | 699 if (tests[index].fun == stopTest) { |
| 699 SkDebugf("lastTest\n"); | 700 SkDebugf("lastTest\n"); |
| 700 } | 701 } |
| 701 if (index == last) { | 702 if (index == last) { |
| 702 break; | 703 break; |
| 703 } | 704 } |
| 704 index += reverse ? -1 : 1; | 705 index += reverse ? -1 : 1; |
| 705 } while (true); | 706 } while (true); |
| 706 } | 707 } |
| OLD | NEW |