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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 showPathOpPath(one, two, a, b, scaledOne, scaledTwo, shapeOp, scale); | 440 showPathOpPath(one, two, a, b, scaledOne, scaledTwo, shapeOp, scale); |
441 } | 441 } |
442 if (errors2x2 > MAX_ERRORS && gComparePathsAssert) { | 442 if (errors2x2 > MAX_ERRORS && gComparePathsAssert) { |
443 SkDebugf("%s errors=%d\n", __FUNCTION__, errors); | 443 SkDebugf("%s errors=%d\n", __FUNCTION__, errors); |
444 showPathOpPath(one, two, a, b, scaledOne, scaledTwo, shapeOp, scale); | 444 showPathOpPath(one, two, a, b, scaledOne, scaledTwo, shapeOp, scale); |
445 REPORTER_ASSERT(reporter, 0); | 445 REPORTER_ASSERT(reporter, 0); |
446 } | 446 } |
447 return errors2x2 > MAX_ERRORS ? errors2x2 : 0; | 447 return errors2x2 > MAX_ERRORS ? errors2x2 : 0; |
448 } | 448 } |
449 | 449 |
450 static int testNumber; | 450 // Default values for when reporter->verbose() is false. |
451 static const char* testName; | 451 static int testNumber = 1; |
| 452 static const char* testName = "pathOpTest"; |
452 | 453 |
453 static void writeTestName(const char* nameSuffix, SkMemoryWStream& outFile) { | 454 static void writeTestName(const char* nameSuffix, SkMemoryWStream& outFile) { |
454 outFile.writeText(testName); | 455 outFile.writeText(testName); |
455 outFile.writeDecAsText(testNumber); | 456 outFile.writeDecAsText(testNumber); |
456 if (nameSuffix) { | 457 if (nameSuffix) { |
457 outFile.writeText(nameSuffix); | 458 outFile.writeText(nameSuffix); |
458 } | 459 } |
459 } | 460 } |
460 | 461 |
461 static void outputToStream(const char* pathStr, const char* pathPrefix, const ch
ar* nameSuffix, | 462 static void outputToStream(const char* pathStr, const char* pathPrefix, const ch
ar* nameSuffix, |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 size_t inLen = inData.count(); | 649 size_t inLen = inData.count(); |
649 inFile.read(inData.begin(), inLen); | 650 inFile.read(inData.begin(), inLen); |
650 inFile.setPath(NULL); | 651 inFile.setPath(NULL); |
651 char* insert = strstr(inData.begin(), marker); | 652 char* insert = strstr(inData.begin(), marker); |
652 if (insert) { | 653 if (insert) { |
653 insert += sizeof(marker) - 1; | 654 insert += sizeof(marker) - 1; |
654 const char* numLoc = insert + 4 /* indent spaces */ + testNameSi
ze - 1; | 655 const char* numLoc = insert + 4 /* indent spaces */ + testNameSi
ze - 1; |
655 testNumber = atoi(numLoc) + 1; | 656 testNumber = atoi(numLoc) + 1; |
656 } | 657 } |
657 } | 658 } |
658 } else { | |
659 testName = "pathOpTest"; | |
660 testNumber = 1; | |
661 } | 659 } |
662 return reporter->allowThreaded() ? SkThreadPool::kThreadPerCore : 1; | 660 return reporter->allowThreaded() ? SkThreadPool::kThreadPerCore : 1; |
663 } | 661 } |
664 | 662 |
665 void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType pathFill
Type) { | 663 void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType pathFill
Type) { |
666 const char testFunction[] = "testSimplify(path);"; | 664 const char testFunction[] = "testSimplify(path);"; |
667 const char* pathPrefix = NULL; | 665 const char* pathPrefix = NULL; |
668 const char* nameSuffix = NULL; | 666 const char* nameSuffix = NULL; |
669 if (pathFillType == SkPath::kEvenOdd_FillType) { | 667 if (pathFillType == SkPath::kEvenOdd_FillType) { |
670 pathPrefix = " path.setFillType(SkPath::kEvenOdd_FillType);\n"; | 668 pathPrefix = " path.setFillType(SkPath::kEvenOdd_FillType);\n"; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 } | 707 } |
710 if (tests[index].fun == stopTest) { | 708 if (tests[index].fun == stopTest) { |
711 SkDebugf("lastTest\n"); | 709 SkDebugf("lastTest\n"); |
712 } | 710 } |
713 if (index == last) { | 711 if (index == last) { |
714 break; | 712 break; |
715 } | 713 } |
716 index += reverse ? -1 : 1; | 714 index += reverse ? -1 : 1; |
717 } while (true); | 715 } while (true); |
718 } | 716 } |
OLD | NEW |