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 "SkTaskGroup.h" | |
18 #include "SkThread.h" | 17 #include "SkThread.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; |
25 | 25 |
26 static const char marker[] = | 26 static const char marker[] = |
27 "</div>\n" | 27 "</div>\n" |
28 "\n" | 28 "\n" |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 return true; | 535 return true; |
536 } | 536 } |
537 | 537 |
538 bool testThreadedPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkP
ath& b, | 538 bool testThreadedPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkP
ath& b, |
539 const SkPathOp shapeOp, const char* testName) { | 539 const SkPathOp shapeOp, const char* testName) { |
540 return innerPathOp(reporter, a, b, shapeOp, testName, true); | 540 return innerPathOp(reporter, a, b, shapeOp, testName, true); |
541 } | 541 } |
542 | 542 |
543 SK_DECLARE_STATIC_MUTEX(gMutex); | 543 SK_DECLARE_STATIC_MUTEX(gMutex); |
544 | 544 |
545 void initializeTests(skiatest::Reporter* reporter, const char* test) { | 545 int initializeTests(skiatest::Reporter* reporter, const char* test) { |
546 #if 0 // doesn't work yet | 546 #if 0 // doesn't work yet |
547 SK_CONF_SET("images.jpeg.suppressDecoderWarnings", true); | 547 SK_CONF_SET("images.jpeg.suppressDecoderWarnings", true); |
548 SK_CONF_SET("images.png.suppressDecoderWarnings", true); | 548 SK_CONF_SET("images.png.suppressDecoderWarnings", true); |
549 #endif | 549 #endif |
550 if (reporter->verbose()) { | 550 if (reporter->verbose()) { |
551 SkAutoMutexAcquire lock(gMutex); | 551 SkAutoMutexAcquire lock(gMutex); |
552 testName = test; | 552 testName = test; |
553 size_t testNameSize = strlen(test); | 553 size_t testNameSize = strlen(test); |
554 SkFILEStream inFile("../../experimental/Intersection/op.htm"); | 554 SkFILEStream inFile("../../experimental/Intersection/op.htm"); |
555 if (inFile.isValid()) { | 555 if (inFile.isValid()) { |
556 SkTDArray<char> inData; | 556 SkTDArray<char> inData; |
557 inData.setCount((int) inFile.getLength()); | 557 inData.setCount((int) inFile.getLength()); |
558 size_t inLen = inData.count(); | 558 size_t inLen = inData.count(); |
559 inFile.read(inData.begin(), inLen); | 559 inFile.read(inData.begin(), inLen); |
560 inFile.setPath(NULL); | 560 inFile.setPath(NULL); |
561 char* insert = strstr(inData.begin(), marker); | 561 char* insert = strstr(inData.begin(), marker); |
562 if (insert) { | 562 if (insert) { |
563 insert += sizeof(marker) - 1; | 563 insert += sizeof(marker) - 1; |
564 const char* numLoc = insert + 4 /* indent spaces */ + testNameSi
ze - 1; | 564 const char* numLoc = insert + 4 /* indent spaces */ + testNameSi
ze - 1; |
565 testNumber = atoi(numLoc) + 1; | 565 testNumber = atoi(numLoc) + 1; |
566 } | 566 } |
567 } | 567 } |
568 } | 568 } |
| 569 return reporter->allowThreaded() ? SkThreadPool::kThreadPerCore : 1; |
569 } | 570 } |
570 | 571 |
571 void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType pathFill
Type) { | 572 void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType pathFill
Type) { |
572 const char testFunction[] = "testSimplify(path);"; | 573 const char testFunction[] = "testSimplify(path);"; |
573 const char* pathPrefix = NULL; | 574 const char* pathPrefix = NULL; |
574 const char* nameSuffix = NULL; | 575 const char* nameSuffix = NULL; |
575 if (pathFillType == SkPath::kEvenOdd_FillType) { | 576 if (pathFillType == SkPath::kEvenOdd_FillType) { |
576 pathPrefix = " path.setFillType(SkPath::kEvenOdd_FillType);\n"; | 577 pathPrefix = " path.setFillType(SkPath::kEvenOdd_FillType);\n"; |
577 nameSuffix = "x"; | 578 nameSuffix = "x"; |
578 } | 579 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 if (tests[index].fun == stopTest) { | 620 if (tests[index].fun == stopTest) { |
620 SkDebugf("lastTest\n"); | 621 SkDebugf("lastTest\n"); |
621 break; | 622 break; |
622 } | 623 } |
623 if (index == last) { | 624 if (index == last) { |
624 break; | 625 break; |
625 } | 626 } |
626 index += reverse ? -1 : 1; | 627 index += reverse ? -1 : 1; |
627 } while (true); | 628 } while (true); |
628 } | 629 } |
OLD | NEW |