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 #include "PathOpsExtendedTest.h" | 7 #include "PathOpsExtendedTest.h" |
8 #include "PathOpsThreadedCommon.h" | 8 #include "PathOpsThreadedCommon.h" |
9 | 9 |
10 static void testSimplifyQuadralateralsMain(PathOpsThreadState* data) | 10 static void testSimplifyQuadralateralsMain(PathOpsThreadState* data) |
11 { | 11 { |
12 SkASSERT(data); | 12 SkASSERT(data); |
13 PathOpsThreadState& state = *data; | 13 PathOpsThreadState& state = *data; |
14 char pathStr[1024]; | 14 char pathStr[1024]; |
15 sk_bzero(pathStr, sizeof(pathStr)); | 15 bool progress = state.fReporter->verbose(); // FIXME: break out into its own
parameter? |
| 16 if (progress) { |
| 17 sk_bzero(pathStr, sizeof(pathStr)); |
| 18 } |
16 int ax = state.fA & 0x03; | 19 int ax = state.fA & 0x03; |
17 int ay = state.fA >> 2; | 20 int ay = state.fA >> 2; |
18 int bx = state.fB & 0x03; | 21 int bx = state.fB & 0x03; |
19 int by = state.fB >> 2; | 22 int by = state.fB >> 2; |
20 int cx = state.fC & 0x03; | 23 int cx = state.fC & 0x03; |
21 int cy = state.fC >> 2; | 24 int cy = state.fC >> 2; |
22 int dx = state.fD & 0x03; | 25 int dx = state.fD & 0x03; |
23 int dy = state.fD >> 2; | 26 int dy = state.fD >> 2; |
24 for (int e = 0 ; e < 16; ++e) { | 27 for (int e = 0 ; e < 16; ++e) { |
25 int ex = e & 0x03; | 28 int ex = e & 0x03; |
(...skipping 12 matching lines...) Expand all Loading... |
38 path.moveTo(SkIntToScalar(ax), SkIntToScalar(ay)); | 41 path.moveTo(SkIntToScalar(ax), SkIntToScalar(ay)); |
39 path.lineTo(SkIntToScalar(bx), SkIntToScalar(by)); | 42 path.lineTo(SkIntToScalar(bx), SkIntToScalar(by)); |
40 path.lineTo(SkIntToScalar(cx), SkIntToScalar(cy)); | 43 path.lineTo(SkIntToScalar(cx), SkIntToScalar(cy)); |
41 path.lineTo(SkIntToScalar(dx), SkIntToScalar(dy)); | 44 path.lineTo(SkIntToScalar(dx), SkIntToScalar(dy)); |
42 path.close(); | 45 path.close(); |
43 path.moveTo(SkIntToScalar(ex), SkIntToScalar(ey)); | 46 path.moveTo(SkIntToScalar(ex), SkIntToScalar(ey)); |
44 path.lineTo(SkIntToScalar(fx), SkIntToScalar(fy)); | 47 path.lineTo(SkIntToScalar(fx), SkIntToScalar(fy)); |
45 path.lineTo(SkIntToScalar(gx), SkIntToScalar(gy)); | 48 path.lineTo(SkIntToScalar(gx), SkIntToScalar(gy)); |
46 path.lineTo(SkIntToScalar(hx), SkIntToScalar(hy)); | 49 path.lineTo(SkIntToScalar(hx), SkIntToScalar(hy)); |
47 path.close(); | 50 path.close(); |
48 // gdb: set print elements 400 | 51 if (progress) { |
49 char* str = pathStr; | 52 // gdb: set print elements 400 |
50 str += sprintf(str, " path.moveTo(%d, %d);\n", ax, ay); | 53 char* str = pathStr; |
51 str += sprintf(str, " path.lineTo(%d, %d);\n", bx, by); | 54 str += sprintf(str, " path.moveTo(%d, %d);\n", ax, ay
); |
52 str += sprintf(str, " path.lineTo(%d, %d);\n", cx, cy); | 55 str += sprintf(str, " path.lineTo(%d, %d);\n", bx, by
); |
53 str += sprintf(str, " path.lineTo(%d, %d);\n", dx, dy); | 56 str += sprintf(str, " path.lineTo(%d, %d);\n", cx, cy
); |
54 str += sprintf(str, " path.close();\n"); | 57 str += sprintf(str, " path.lineTo(%d, %d);\n", dx, dy
); |
55 str += sprintf(str, " path.moveTo(%d, %d);\n", ex, ey); | 58 str += sprintf(str, " path.close();\n"); |
56 str += sprintf(str, " path.lineTo(%d, %d);\n", fx, fy); | 59 str += sprintf(str, " path.moveTo(%d, %d);\n", ex, ey
); |
57 str += sprintf(str, " path.lineTo(%d, %d);\n", gx, gy); | 60 str += sprintf(str, " path.lineTo(%d, %d);\n", fx, fy
); |
58 str += sprintf(str, " path.lineTo(%d, %d);\n", hx, hy); | 61 str += sprintf(str, " path.lineTo(%d, %d);\n", gx, gy
); |
59 str += sprintf(str, " path.close();\n"); | 62 str += sprintf(str, " path.lineTo(%d, %d);\n", hx, hy
); |
60 outputProgress(state.fPathStr, pathStr, SkPath::kWinding_Fil
lType); | 63 str += sprintf(str, " path.close();\n"); |
| 64 outputProgress(state.fPathStr, pathStr, SkPath::kWinding
_FillType); |
| 65 } |
61 testSimplify(path, false, out, state, pathStr); | 66 testSimplify(path, false, out, state, pathStr); |
62 path.setFillType(SkPath::kEvenOdd_FillType); | 67 path.setFillType(SkPath::kEvenOdd_FillType); |
63 outputProgress(state.fPathStr, pathStr, SkPath::kEvenOdd_Fil
lType); | 68 if (progress) { |
| 69 outputProgress(state.fPathStr, pathStr, SkPath::kEvenOdd
_FillType); |
| 70 } |
64 testSimplify(path, true, out, state, pathStr); | 71 testSimplify(path, true, out, state, pathStr); |
65 } | 72 } |
66 } | 73 } |
67 } | 74 } |
68 } | 75 } |
69 } | 76 } |
70 | 77 |
71 static void PathOpsSimplifyQuadralateralsThreadedTest(skiatest::Reporter* report
er) { | 78 static void PathOpsSimplifyQuadralateralsThreadedTest(skiatest::Reporter* report
er) { |
72 int threadCount = initializeTests(reporter, "testQuadralaterals"); | 79 int threadCount = initializeTests(reporter, "testQuadralaterals"); |
73 PathOpsThreadedTestRunner testRunner(reporter, threadCount); | 80 PathOpsThreadedTestRunner testRunner(reporter, threadCount); |
74 for (int a = 0; a < 16; ++a) { | 81 for (int a = 0; a < 16; ++a) { |
75 for (int b = a ; b < 16; ++b) { | 82 for (int b = a ; b < 16; ++b) { |
76 for (int c = b ; c < 16; ++c) { | 83 for (int c = b ; c < 16; ++c) { |
77 for (int d = c; d < 16; ++d) { | 84 for (int d = c; d < 16; ++d) { |
78 *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreaded
Runnable, | 85 *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreaded
Runnable, |
79 (&testSimplifyQuadralateralsMain, a, b, c, d, &testR
unner)); | 86 (&testSimplifyQuadralateralsMain, a, b, c, d, &testR
unner)); |
80 } | 87 } |
81 if (!reporter->allowExtendedTest()) goto finish; | 88 if (!reporter->allowExtendedTest()) goto finish; |
82 } | 89 } |
83 } | 90 } |
84 } | 91 } |
85 finish: | 92 finish: |
86 testRunner.render(); | 93 testRunner.render(); |
87 } | 94 } |
88 | 95 |
89 #include "TestClassDef.h" | 96 #include "TestClassDef.h" |
90 DEFINE_TESTCLASS_SHORT(PathOpsSimplifyQuadralateralsThreadedTest) | 97 DEFINE_TESTCLASS_SHORT(PathOpsSimplifyQuadralateralsThreadedTest) |
OLD | NEW |