OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2012 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 #include "PathOpsExtendedTest.h" |
| 8 |
| 9 // four rects, of four sizes |
| 10 // for 3 smaller sizes, tall, wide |
| 11 // top upper mid lower bottom aligned (3 bits, 5 values) |
| 12 // same with x (3 bits, 5 values) |
| 13 // not included, square, tall, wide (2 bits) |
| 14 // cw or ccw (1 bit) |
| 15 |
| 16 static void* testPathOpsRectsMain(void* data) |
| 17 { |
| 18 SkASSERT(data); |
| 19 State4& state = *(State4*) data; |
| 20 char pathStr[1024]; // gdb: set print elements 400 |
| 21 bzero(pathStr, sizeof(pathStr)); |
| 22 do { |
| 23 for (int a = 0 ; a < 6; ++a) { |
| 24 for (int b = a + 1 ; b < 7; ++b) { |
| 25 for (int c = 0 ; c < 6; ++c) { |
| 26 for (int d = c + 1 ; d < 7; ++d) { |
| 27 for (int e = SkPath::kWinding_FillType ; e <= SkPath::kEvenOdd_FillType;
++e) { |
| 28 for (int f = SkPath::kWinding_FillType ; f <= SkPath::kEvenOdd_FillType;
++f) { |
| 29 SkPath pathA, pathB; |
| 30 char* str = pathStr; |
| 31 pathA.setFillType((SkPath::FillType) e); |
| 32 str += sprintf(str, " path.setFillType(SkPath::k%s_FillType);\n", |
| 33 e == SkPath::kWinding_FillType ? "Winding" : e == SkPath::kE
venOdd_FillType |
| 34 ? "EvenOdd" : "?UNDEFINED"); |
| 35 pathA.addRect(state.a, state.a, state.b, state.b, SkPath::kCW_Direct
ion); |
| 36 str += sprintf(str, " path.addRect(%d, %d, %d, %d," |
| 37 " SkPath::kCW_Direction);\n", state.a, state.a, state.b, sta
te.b); |
| 38 pathA.addRect(state.c, state.c, state.d, state.d, SkPath::kCW_Direct
ion); |
| 39 str += sprintf(str, " path.addRect(%d, %d, %d, %d," |
| 40 " SkPath::kCW_Direction);\n", state.c, state.c, state.d, sta
te.d); |
| 41 pathA.close(); |
| 42 pathB.setFillType((SkPath::FillType) f); |
| 43 str += sprintf(str, " pathB.setFillType(SkPath::k%s_FillType);\n"
, |
| 44 f == SkPath::kWinding_FillType ? "Winding" : f == SkPath::kE
venOdd_FillType |
| 45 ? "EvenOdd" : "?UNDEFINED"); |
| 46 pathB.addRect(a, a, b, b, SkPath::kCW_Direction); |
| 47 str += sprintf(str, " pathB.addRect(%d, %d, %d, %d," |
| 48 " SkPath::kCW_Direction);\n", a, a, b, b); |
| 49 pathB.addRect(c, c, d, d, SkPath::kCW_Direction); |
| 50 str += sprintf(str, " pathB.addRect(%d, %d, %d, %d," |
| 51 " SkPath::kCW_Direction);\n", c, c, d, d); |
| 52 pathB.close(); |
| 53 for (int op = 0 ; op <= kXOR_PathOp; ++op) { |
| 54 outputProgress(state, pathStr, (SkPathOp) op); |
| 55 testPathOp(state.reporter, pathA, pathB, (SkPathOp) op); |
| 56 state.testsRun++; |
| 57 } |
| 58 } |
| 59 } |
| 60 } |
| 61 } |
| 62 } |
| 63 } |
| 64 } while (runNextTestSet(state)); |
| 65 return NULL; |
| 66 } |
| 67 |
| 68 static void TestPathOpsRectsThreaded(skiatest::Reporter* reporter) { |
| 69 int testsRun = 0; |
| 70 if (gShowTestProgress) SkDebugf("%s\n", __FUNCTION__); |
| 71 #ifdef SK_DEBUG |
| 72 gDebugMaxWindSum = 4; |
| 73 gDebugMaxWindValue = 4; |
| 74 #endif |
| 75 const char testLineStr[] = "testOp"; |
| 76 initializeTests(reporter, testLineStr, sizeof(testLineStr)); |
| 77 for (int a = 0; a < 6; ++a) { // outermost |
| 78 for (int b = a + 1; b < 7; ++b) { |
| 79 for (int c = 0 ; c < 6; ++c) { |
| 80 for (int d = c + 1; d < 7; ++d) { |
| 81 testsRun += dispatchTest4(testPathOpsRectsMain, a, b, c, d); |
| 82 } |
| 83 if (gShowTestProgress) SkDebugf("."); |
| 84 } |
| 85 if (!gAllowExtendedTest) goto finish; |
| 86 if (gShowTestProgress) SkDebugf("%d", b); |
| 87 } |
| 88 if (gShowTestProgress) SkDebugf("\n%d", a); |
| 89 } |
| 90 finish: |
| 91 testsRun += waitForCompletion(); |
| 92 if (gShowTestProgress) SkDebugf("%s tests=%d total=%d\n", __FUNCTION__, test
sRun); |
| 93 } |
| 94 |
| 95 #include "TestClassDef.h" |
| 96 DEFINE_TESTCLASS("PathOpsRectsThreaded", OpRectsThreadedTestClass, \ |
| 97 TestPathOpsRectsThreaded) |
| 98 |
OLD | NEW |