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 25 matching lines...) Expand all Loading... |
36 "i", | 36 "i", |
37 "u", | 37 "u", |
38 "o", | 38 "o", |
39 }; | 39 }; |
40 | 40 |
41 static bool gShowPath = false; | 41 static bool gShowPath = false; |
42 static bool gComparePaths = true; | 42 static bool gComparePaths = true; |
43 static bool gComparePathsAssert = true; | 43 static bool gComparePathsAssert = true; |
44 static bool gPathStrAssert = true; | 44 static bool gPathStrAssert = true; |
45 | 45 |
46 #if FORCE_RELEASE | |
47 static bool gRunTestsInOneThread = true; | |
48 #else | |
49 static bool gRunTestsInOneThread = true; | |
50 #endif | |
51 | |
52 static void showPathContour(SkPath::Iter& iter) { | 46 static void showPathContour(SkPath::Iter& iter) { |
53 uint8_t verb; | 47 uint8_t verb; |
54 SkPoint pts[4]; | 48 SkPoint pts[4]; |
55 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { | 49 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { |
56 switch (verb) { | 50 switch (verb) { |
57 case SkPath::kMove_Verb: | 51 case SkPath::kMove_Verb: |
58 SkDebugf("path.moveTo(%1.9g,%1.9g);\n", pts[0].fX, pts[0].fY); | 52 SkDebugf("path.moveTo(%1.9g,%1.9g);\n", pts[0].fX, pts[0].fY); |
59 continue; | 53 continue; |
60 case SkPath::kLine_Verb: | 54 case SkPath::kLine_Verb: |
61 SkDebugf("path.lineTo(%1.9g,%1.9g);\n", pts[1].fX, pts[1].fY); | 55 SkDebugf("path.lineTo(%1.9g,%1.9g);\n", pts[1].fX, pts[1].fY); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 if (result && gPathStrAssert) { | 509 if (result && gPathStrAssert) { |
516 REPORTER_ASSERT(reporter, 0); | 510 REPORTER_ASSERT(reporter, 0); |
517 } | 511 } |
518 reporter->bumpTestCount(); | 512 reporter->bumpTestCount(); |
519 return result == 0; | 513 return result == 0; |
520 } | 514 } |
521 | 515 |
522 const int maxThreadsAllocated = 64; | 516 const int maxThreadsAllocated = 64; |
523 static int maxThreads = 1; | 517 static int maxThreads = 1; |
524 | 518 |
525 int initializeTests(const char* test) { | 519 int initializeTests(skiatest::Reporter* reporter, const char* test) { |
526 #ifdef SK_DEBUG | 520 #ifdef SK_DEBUG |
527 gDebugMaxWindSum = 4; | 521 gDebugMaxWindSum = 4; |
528 gDebugMaxWindValue = 4; | 522 gDebugMaxWindValue = 4; |
529 #endif | 523 #endif |
530 testName = test; | 524 testName = test; |
531 size_t testNameSize = strlen(test); | 525 size_t testNameSize = strlen(test); |
532 if (!gRunTestsInOneThread) { | 526 if (reporter->allowThreaded()) { |
533 int threads = -1; | 527 int threads = -1; |
534 #ifdef SK_BUILD_FOR_MAC | 528 #ifdef SK_BUILD_FOR_MAC |
535 size_t size = sizeof(threads); | 529 size_t size = sizeof(threads); |
536 sysctlbyname("hw.logicalcpu_max", &threads, &size, NULL, 0); | 530 sysctlbyname("hw.logicalcpu_max", &threads, &size, NULL, 0); |
537 #endif | 531 #endif |
538 if (threads > 0) { | 532 if (threads > 0) { |
539 maxThreads = threads; | 533 maxThreads = threads; |
540 } else { | 534 } else { |
541 maxThreads = 16; | 535 maxThreads = 16; |
542 } | 536 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 } | 599 } |
606 if (tests[index].fun == stopTest) { | 600 if (tests[index].fun == stopTest) { |
607 SkDebugf("lastTest\n"); | 601 SkDebugf("lastTest\n"); |
608 } | 602 } |
609 if (index == last) { | 603 if (index == last) { |
610 break; | 604 break; |
611 } | 605 } |
612 index += reverse ? -1 : 1; | 606 index += reverse ? -1 : 1; |
613 } while (true); | 607 } while (true); |
614 } | 608 } |
OLD | NEW |