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 testSimplifyQuadsMain(PathOpsThreadState* data) | 10 static void testSimplifyQuadsMain(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.quadTo(SkIntToScalar(bx), SkIntToScalar(by), | 42 path.quadTo(SkIntToScalar(bx), SkIntToScalar(by), |
40 SkIntToScalar(cx), SkIntToScalar(cy)); | 43 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.quadTo(SkIntToScalar(gx), SkIntToScalar(gy), | 48 path.quadTo(SkIntToScalar(gx), SkIntToScalar(gy), |
46 SkIntToScalar(hx), SkIntToScalar(hy)); | 49 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.quadTo(%d, %d, %d, %d);\n", bx
, by, cx, cy); | 54 str += sprintf(str, " path.moveTo(%d, %d);\n", ax, ay
); |
52 str += sprintf(str, " path.lineTo(%d, %d);\n", dx, dy); | 55 str += sprintf(str, " path.quadTo(%d, %d, %d, %d);\n"
, bx, by, cx, cy); |
53 str += sprintf(str, " path.close();\n"); | 56 str += sprintf(str, " path.lineTo(%d, %d);\n", dx, dy
); |
54 str += sprintf(str, " path.moveTo(%d, %d);\n", ex, ey); | 57 str += sprintf(str, " path.close();\n"); |
55 str += sprintf(str, " path.lineTo(%d, %d);\n", fx, fy); | 58 str += sprintf(str, " path.moveTo(%d, %d);\n", ex, ey
); |
56 str += sprintf(str, " path.quadTo(%d, %d, %d, %d);\n", gx
, gy, hx, hy); | 59 str += sprintf(str, " path.lineTo(%d, %d);\n", fx, fy
); |
57 str += sprintf(str, " path.close();\n"); | 60 str += sprintf(str, " path.quadTo(%d, %d, %d, %d);\n"
, gx, gy, hx, hy); |
58 outputProgress(state.fPathStr, pathStr, SkPath::kWinding_Fil
lType); | 61 str += sprintf(str, " path.close();\n"); |
| 62 outputProgress(state.fPathStr, pathStr, SkPath::kWinding
_FillType); |
| 63 } |
59 testSimplify(path, false, out, state, pathStr); | 64 testSimplify(path, false, out, state, pathStr); |
60 path.setFillType(SkPath::kEvenOdd_FillType); | 65 path.setFillType(SkPath::kEvenOdd_FillType); |
61 outputProgress(state.fPathStr, pathStr, SkPath::kEvenOdd_Fil
lType); | 66 if (progress) { |
| 67 outputProgress(state.fPathStr, pathStr, SkPath::kEvenOdd
_FillType); |
| 68 } |
62 testSimplify(path, true, out, state, pathStr); | 69 testSimplify(path, true, out, state, pathStr); |
63 } | 70 } |
64 } | 71 } |
65 } | 72 } |
66 } | 73 } |
67 } | 74 } |
68 | 75 |
69 static void PathOpsSimplifyQuadsThreadedTest(skiatest::Reporter* reporter) | 76 static void PathOpsSimplifyQuadsThreadedTest(skiatest::Reporter* reporter) |
70 { | 77 { |
71 int threadCount = initializeTests(reporter, "testQuads"); | 78 int threadCount = initializeTests(reporter, "testQuads"); |
72 PathOpsThreadedTestRunner testRunner(reporter, threadCount); | 79 PathOpsThreadedTestRunner testRunner(reporter, threadCount); |
73 int a = 0; | 80 int a = 0; |
74 for (; a < 16; ++a) { | 81 for (; 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 (&testSimplifyQuadsMain, a, b, c, d, &testRunner)); | 86 (&testSimplifyQuadsMain, a, b, c, d, &testRunner)); |
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(PathOpsSimplifyQuadsThreadedTest) | 97 DEFINE_TESTCLASS_SHORT(PathOpsSimplifyQuadsThreadedTest) |
OLD | NEW |