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 // four rects, of four sizes | 10 // four rects, of four sizes |
(...skipping 11 matching lines...) Expand all Loading... |
22 bool progress = state.fReporter->verbose(); // FIXME: break out into its own
parameter? | 22 bool progress = state.fReporter->verbose(); // FIXME: break out into its own
parameter? |
23 if (progress) { | 23 if (progress) { |
24 sk_bzero(pathStr, sizeof(pathStr)); | 24 sk_bzero(pathStr, sizeof(pathStr)); |
25 } | 25 } |
26 for (int a = 0 ; a < 6; ++a) { | 26 for (int a = 0 ; a < 6; ++a) { |
27 for (int b = a + 1 ; b < 7; ++b) { | 27 for (int b = a + 1 ; b < 7; ++b) { |
28 for (int c = 0 ; c < 6; ++c) { | 28 for (int c = 0 ; c < 6; ++c) { |
29 for (int d = c + 1 ; d < 7; ++d) { | 29 for (int d = c + 1 ; d < 7; ++d) { |
30 for (int e = SkPath::kWinding_FillType ; e <= SkPath::kEvenO
dd_FillType; ++e) { | 30 for (int e = SkPath::kWinding_FillType ; e <= SkPath::kEvenO
dd_FillType; ++e) { |
31 for (int f = SkPath::kWinding_FillType ; f <= SkPath::kEvenOdd_FillType; ++f
) { | 31 for (int f = SkPath::kWinding_FillType ; f <= SkPath::kEvenOdd_FillType; ++f
) { |
| 32 static int testNum = 6; |
32 if (progress) { | 33 if (progress) { |
33 char* str = pathStr; | 34 char* str = pathStr; |
| 35 str += sprintf(str, |
| 36 "static void rects%d(skiatest::Reporter* reporter, const cha
r* filename) {\n", |
| 37 testNum); |
| 38 str += sprintf(str, " SkPath path, pathB;"); |
34 str += sprintf(str, " path.setFillType(SkPath::k%s_FillType);\n", | 39 str += sprintf(str, " path.setFillType(SkPath::k%s_FillType);\n", |
35 e == SkPath::kWinding_FillType ? "Winding" : e == SkPath::kE
venOdd_FillType | 40 e == SkPath::kWinding_FillType ? "Winding" : e == SkPath::kE
venOdd_FillType |
36 ? "EvenOdd" : "?UNDEFINED"); | 41 ? "EvenOdd" : "?UNDEFINED"); |
37 str += sprintf(str, " path.addRect(%d, %d, %d, %d," | 42 str += sprintf(str, " path.addRect(%d, %d, %d, %d," |
38 " SkPath::kCW_Direction);\n", state.fA, state.fA, state.fB,
state.fB); | 43 " SkPath::kCW_Direction);\n", state.fA, state.fA, state.fB,
state.fB); |
39 str += sprintf(str, " path.addRect(%d, %d, %d, %d," | 44 str += sprintf(str, " path.addRect(%d, %d, %d, %d," |
40 " SkPath::kCW_Direction);\n", state.fC, state.fC, state.fD,
state.fD); | 45 " SkPath::kCW_Direction);\n", state.fC, state.fC, state.fD,
state.fD); |
41 str += sprintf(str, " pathB.setFillType(SkPath::k%s_FillType);\n"
, | 46 str += sprintf(str, " pathB.setFillType(SkPath::k%s_FillType);\n"
, |
42 f == SkPath::kWinding_FillType ? "Winding" : f == SkPath::kE
venOdd_FillType | 47 f == SkPath::kWinding_FillType ? "Winding" : f == SkPath::kE
venOdd_FillType |
43 ? "EvenOdd" : "?UNDEFINED"); | 48 ? "EvenOdd" : "?UNDEFINED"); |
44 str += sprintf(str, " pathB.addRect(%d, %d, %d, %d," | 49 str += sprintf(str, " pathB.addRect(%d, %d, %d, %d," |
45 " SkPath::kCW_Direction);\n", a, a, b, b); | 50 " SkPath::kCW_Direction);\n", a, a, b, b); |
46 str += sprintf(str, " pathB.addRect(%d, %d, %d, %d," | 51 str += sprintf(str, " pathB.addRect(%d, %d, %d, %d," |
47 " SkPath::kCW_Direction);\n", c, c, d, d); | 52 " SkPath::kCW_Direction);\n", c, c, d, d); |
| 53 str += sprintf(str, |
| 54 " testPathOp(reporter, path, pathB, kDifference_SkPathOp,
filename);\n"); |
| 55 str += sprintf(str, "}\n\n"); |
48 } | 56 } |
49 SkPath pathA, pathB; | 57 SkPath pathA, pathB; |
50 pathA.setFillType((SkPath::FillType) e); | 58 pathA.setFillType((SkPath::FillType) e); |
51 pathA.addRect(SkIntToScalar(state.fA), SkIntToScalar(state.fA), SkIntToS
calar(state.fB), | 59 pathA.addRect(SkIntToScalar(state.fA), SkIntToScalar(state.fA), SkIntToS
calar(state.fB), |
52 SkIntToScalar(state.fB), SkPath::kCW_Direction); | 60 SkIntToScalar(state.fB), SkPath::kCW_Direction); |
53 pathA.addRect(SkIntToScalar(state.fC), SkIntToScalar(state.fC), SkIntToS
calar(state.fD), | 61 pathA.addRect(SkIntToScalar(state.fC), SkIntToScalar(state.fC), SkIntToS
calar(state.fD), |
54 SkIntToScalar(state.fD), SkPath::kCW_Direction); | 62 SkIntToScalar(state.fD), SkPath::kCW_Direction); |
55 pathA.close(); | 63 pathA.close(); |
56 pathB.setFillType((SkPath::FillType) f); | 64 pathB.setFillType((SkPath::FillType) f); |
57 pathB.addRect(SkIntToScalar(a), SkIntToScalar(a), SkIntToScalar(b), | 65 pathB.addRect(SkIntToScalar(a), SkIntToScalar(a), SkIntToScalar(b), |
(...skipping 25 matching lines...) Expand all Loading... |
83 *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreaded
Runnable, | 91 *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreaded
Runnable, |
84 (&testPathOpsRectsMain, a, b, c, d, &testRunner)); | 92 (&testPathOpsRectsMain, a, b, c, d, &testRunner)); |
85 } | 93 } |
86 } | 94 } |
87 if (!reporter->allowExtendedTest()) goto finish; | 95 if (!reporter->allowExtendedTest()) goto finish; |
88 } | 96 } |
89 } | 97 } |
90 finish: | 98 finish: |
91 testRunner.render(); | 99 testRunner.render(); |
92 } | 100 } |
OLD | NEW |