| 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" |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkForceLinking.h" | 12 #include "SkForceLinking.h" |
| 13 #include "SkMatrix.h" | 13 #include "SkMatrix.h" |
| 14 #include "SkPaint.h" | 14 #include "SkPaint.h" |
| 15 #include "SkRTConf.h" | 15 #include "SkRTConf.h" |
| 16 #include "SkStream.h" | 16 #include "SkStream.h" |
| 17 #include "SkThread.h" | 17 #include "SkThread.h" |
| 18 #include "SkThreadPool.h" | 18 #include "SkThreadPool.h" |
| 19 | 19 |
| 20 #ifdef SK_BUILD_FOR_MAC | 20 #ifdef SK_BUILD_FOR_MAC |
| 21 #include <sys/sysctl.h> | 21 #include <sys/sysctl.h> |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 __SK_FORCE_IMAGE_DECODER_LINKING; | 24 __SK_FORCE_IMAGE_DECODER_LINKING; |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 SkBitmap bitmap; | 559 SkBitmap bitmap; |
| 560 int result = comparePaths(reporter, filename, path, out, bitmap); | 560 int result = comparePaths(reporter, filename, path, out, bitmap); |
| 561 if (result && gPathStrAssert) { | 561 if (result && gPathStrAssert) { |
| 562 REPORTER_ASSERT(reporter, 0); | 562 REPORTER_ASSERT(reporter, 0); |
| 563 } | 563 } |
| 564 reporter->bumpTestCount(); | 564 reporter->bumpTestCount(); |
| 565 return result == 0; | 565 return result == 0; |
| 566 } | 566 } |
| 567 | 567 |
| 568 #if DEBUG_SHOW_TEST_NAME | 568 #if DEBUG_SHOW_TEST_NAME |
| 569 |
| 570 SK_DECLARE_STATIC_MUTEX(gTestMutex); |
| 571 |
| 569 void SkPathOpsDebug::ShowPath(const SkPath& a, const SkPath& b, SkPathOp shapeOp
, | 572 void SkPathOpsDebug::ShowPath(const SkPath& a, const SkPath& b, SkPathOp shapeOp
, |
| 570 const char* testName) { | 573 const char* testName) { |
| 574 SkAutoMutexAcquire ac(gTestMutex); |
| 571 ShowFunctionHeader(testName); | 575 ShowFunctionHeader(testName); |
| 572 showPath(a, "path", true); | 576 showPath(a, "path", true); |
| 573 showPath(b, "pathB", true); | 577 showPath(b, "pathB", true); |
| 574 ShowOp(shapeOp, "path", "pathB"); | 578 ShowOp(shapeOp, "path", "pathB"); |
| 575 } | 579 } |
| 576 #endif | 580 #endif |
| 577 | 581 |
| 578 #if DEBUG_SHOW_TEST_NAME | 582 #if DEBUG_SHOW_TEST_NAME |
| 579 static void showName(const SkPath& a, const SkPath& b, const SkPathOp shapeOp) { | 583 static void showName(const SkPath& a, const SkPath& b, const SkPathOp shapeOp) { |
| 580 SkDebugf("\n"); | 584 SkDebugf("\n"); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 return innerPathOp(reporter, a, b, shapeOp, testName, true); | 659 return innerPathOp(reporter, a, b, shapeOp, testName, true); |
| 656 } | 660 } |
| 657 | 661 |
| 658 SK_DECLARE_STATIC_MUTEX(gMutex); | 662 SK_DECLARE_STATIC_MUTEX(gMutex); |
| 659 | 663 |
| 660 int initializeTests(skiatest::Reporter* reporter, const char* test) { | 664 int initializeTests(skiatest::Reporter* reporter, const char* test) { |
| 661 #if 0 // doesn't work yet | 665 #if 0 // doesn't work yet |
| 662 SK_CONF_SET("images.jpeg.suppressDecoderWarnings", true); | 666 SK_CONF_SET("images.jpeg.suppressDecoderWarnings", true); |
| 663 SK_CONF_SET("images.png.suppressDecoderWarnings", true); | 667 SK_CONF_SET("images.png.suppressDecoderWarnings", true); |
| 664 #endif | 668 #endif |
| 665 #ifdef SK_DEBUG | |
| 666 SkPathOpsDebug::gMaxWindSum = 4; | |
| 667 SkPathOpsDebug::gMaxWindValue = 4; | |
| 668 #endif | |
| 669 if (reporter->verbose()) { | 669 if (reporter->verbose()) { |
| 670 SkAutoMutexAcquire lock(gMutex); | 670 SkAutoMutexAcquire lock(gMutex); |
| 671 testName = test; | 671 testName = test; |
| 672 size_t testNameSize = strlen(test); | 672 size_t testNameSize = strlen(test); |
| 673 SkFILEStream inFile("../../experimental/Intersection/op.htm"); | 673 SkFILEStream inFile("../../experimental/Intersection/op.htm"); |
| 674 if (inFile.isValid()) { | 674 if (inFile.isValid()) { |
| 675 SkTDArray<char> inData; | 675 SkTDArray<char> inData; |
| 676 inData.setCount((int) inFile.getLength()); | 676 inData.setCount((int) inFile.getLength()); |
| 677 size_t inLen = inData.count(); | 677 size_t inLen = inData.count(); |
| 678 inFile.read(inData.begin(), inLen); | 678 inFile.read(inData.begin(), inLen); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 if (tests[index].fun == stopTest) { | 739 if (tests[index].fun == stopTest) { |
| 740 SkDebugf("lastTest\n"); | 740 SkDebugf("lastTest\n"); |
| 741 break; | 741 break; |
| 742 } | 742 } |
| 743 if (index == last) { | 743 if (index == last) { |
| 744 break; | 744 break; |
| 745 } | 745 } |
| 746 index += reverse ? -1 : 1; | 746 index += reverse ? -1 : 1; |
| 747 } while (true); | 747 } while (true); |
| 748 } | 748 } |
| OLD | NEW |