Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1883)

Side by Side Diff: tests/PathOpsSimplifyQuadThreadedTest.cpp

Issue 14072002: Make parallel unit testing work on windows (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 9
9 static THREAD_TYPE testSimplifyQuadsMain(void* data) 10 static void testSimplifyQuadsMain(PathOpsThreadState* data)
10 { 11 {
11 SkASSERT(data); 12 SkASSERT(data);
12 State4& state = *(State4*) data; 13 PathOpsThreadState& state = *data;
13 char pathStr[1024]; 14 char pathStr[1024];
14 sk_bzero(pathStr, sizeof(pathStr)); 15 sk_bzero(pathStr, sizeof(pathStr));
15 do { 16 int ax = state.fA & 0x03;
16 int ax = state.a & 0x03; 17 int ay = state.fA >> 2;
17 int ay = state.a >> 2; 18 int bx = state.fB & 0x03;
18 int bx = state.b & 0x03; 19 int by = state.fB >> 2;
19 int by = state.b >> 2; 20 int cx = state.fC & 0x03;
20 int cx = state.c & 0x03; 21 int cy = state.fC >> 2;
21 int cy = state.c >> 2; 22 int dx = state.fD & 0x03;
22 int dx = state.d & 0x03; 23 int dy = state.fD >> 2;
23 int dy = state.d >> 2; 24 for (int e = 0 ; e < 16; ++e) {
24 for (int e = 0 ; e < 16; ++e) { 25 int ex = e & 0x03;
25 int ex = e & 0x03; 26 int ey = e >> 2;
26 int ey = e >> 2; 27 for (int f = e ; f < 16; ++f) {
27 for (int f = e ; f < 16; ++f) { 28 int fx = f & 0x03;
28 int fx = f & 0x03; 29 int fy = f >> 2;
29 int fy = f >> 2; 30 for (int g = f ; g < 16; ++g) {
30 for (int g = f ; g < 16; ++g) { 31 int gx = g & 0x03;
31 int gx = g & 0x03; 32 int gy = g >> 2;
32 int gy = g >> 2; 33 for (int h = g ; h < 16; ++h) {
33 for (int h = g ; h < 16; ++h) { 34 int hx = h & 0x03;
34 int hx = h & 0x03; 35 int hy = h >> 2;
35 int hy = h >> 2; 36 SkPath path, out;
36 SkPath path, out; 37 path.setFillType(SkPath::kWinding_FillType);
37 path.setFillType(SkPath::kWinding_FillType); 38 path.moveTo(SkIntToScalar(ax), SkIntToScalar(ay));
38 path.moveTo(SkIntToScalar(ax), SkIntToScalar(ay)); 39 path.quadTo(SkIntToScalar(bx), SkIntToScalar(by),
39 path.quadTo(SkIntToScalar(bx), SkIntToScalar(by), 40 SkIntToScalar(cx), SkIntToScalar(cy));
40 SkIntToScalar(cx), SkIntToScalar(cy)); 41 path.lineTo(SkIntToScalar(dx), SkIntToScalar(dy));
41 path.lineTo(SkIntToScalar(dx), SkIntToScalar(dy)); 42 path.close();
42 path.close(); 43 path.moveTo(SkIntToScalar(ex), SkIntToScalar(ey));
43 path.moveTo(SkIntToScalar(ex), SkIntToScalar(ey)); 44 path.lineTo(SkIntToScalar(fx), SkIntToScalar(fy));
44 path.lineTo(SkIntToScalar(fx), SkIntToScalar(fy)); 45 path.quadTo(SkIntToScalar(gx), SkIntToScalar(gy),
45 path.quadTo(SkIntToScalar(gx), SkIntToScalar(gy), 46 SkIntToScalar(hx), SkIntToScalar(hy));
46 SkIntToScalar(hx), SkIntToScalar(hy)); 47 path.close();
47 path.close(); 48 // gdb: set print elements 400
48 // gdb: set print elements 400 49 char* str = pathStr;
49 char* str = pathStr; 50 str += sprintf(str, " path.moveTo(%d, %d);\n", ax, ay);
50 str += sprintf(str, " path.moveTo(%d, %d);\n", ax, ay ); 51 str += sprintf(str, " path.quadTo(%d, %d, %d, %d);\n", bx , by, cx, cy);
51 str += sprintf(str, " path.quadTo(%d, %d, %d, %d);\n" , bx, by, cx, cy); 52 str += sprintf(str, " path.lineTo(%d, %d);\n", dx, dy);
52 str += sprintf(str, " path.lineTo(%d, %d);\n", dx, dy ); 53 str += sprintf(str, " path.close();\n");
53 str += sprintf(str, " path.close();\n"); 54 str += sprintf(str, " path.moveTo(%d, %d);\n", ex, ey);
54 str += sprintf(str, " path.moveTo(%d, %d);\n", ex, ey ); 55 str += sprintf(str, " path.lineTo(%d, %d);\n", fx, fy);
55 str += sprintf(str, " path.lineTo(%d, %d);\n", fx, fy ); 56 str += sprintf(str, " path.quadTo(%d, %d, %d, %d);\n", gx , gy, hx, hy);
56 str += sprintf(str, " path.quadTo(%d, %d, %d, %d);\n" , gx, gy, hx, hy); 57 str += sprintf(str, " path.close();\n");
57 str += sprintf(str, " path.close();\n"); 58 outputProgress(state.fPathStr, pathStr, SkPath::kWinding_Fil lType);
58 outputProgress(state, pathStr, SkPath::kWinding_FillType ); 59 testSimplify(path, false, out, state, pathStr);
59 testSimplify(path, false, out, state, pathStr); 60 path.setFillType(SkPath::kEvenOdd_FillType);
60 state.testsRun++; 61 outputProgress(state.fPathStr, pathStr, SkPath::kEvenOdd_Fil lType);
61 path.setFillType(SkPath::kEvenOdd_FillType); 62 testSimplify(path, true, out, state, pathStr);
62 outputProgress(state, pathStr, SkPath::kEvenOdd_FillType );
63 testSimplify(path, true, out, state, pathStr);
64 state.testsRun++;
65 }
66 } 63 }
67 } 64 }
68 } 65 }
69 } while (runNextTestSet(state)); 66 }
70 THREAD_RETURN
71 } 67 }
72 68
73 static void TestSimplifyQuadsThreaded(skiatest::Reporter* reporter) 69 static void TestSimplifyQuadsThreaded(skiatest::Reporter* reporter)
74 { 70 {
75 int testsRun = 0; 71 int threadCount = initializeTests("testQuads");
76 if (gShowTestProgress) SkDebugf("%s\n", __FUNCTION__); 72 PathOpsThreadedTestRunner testRunner(reporter, threadCount);
77 #ifdef SK_DEBUG
78 gDebugMaxWindSum = 4; // FIXME: 3?
79 gDebugMaxWindValue = 4;
80 #endif
81 const char testStr[] = "testQuads";
82 initializeTests(reporter, testStr, sizeof(testStr));
83 int a = 0; 73 int a = 0;
84 for (; a < 16; ++a) { 74 for (; a < 16; ++a) {
85 for (int b = a ; b < 16; ++b) { 75 for (int b = a ; b < 16; ++b) {
86 for (int c = b ; c < 16; ++c) { 76 for (int c = b ; c < 16; ++c) {
87 for (int d = c; d < 16; ++d) { 77 for (int d = c; d < 16; ++d) {
88 testsRun += dispatchTest4(testSimplifyQuadsMain, a, b, c, d) ; 78 *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreaded Runnable,
79 (&testSimplifyQuadsMain, a, b, c, d, &testRunner));
89 } 80 }
90 if (!gAllowExtendedTest) goto finish; 81 if (!reporter->allowExtendedTest()) goto finish;
91 if (gShowTestProgress) SkDebugf(".");
92 } 82 }
93 if (gShowTestProgress) SkDebugf("%d", b);
94 } 83 }
95 if (gShowTestProgress) SkDebugf("\n%d", a);
96 } 84 }
97 finish: 85 finish:
98 testsRun += waitForCompletion(); 86 testRunner.render();
99 if (gShowTestProgress) SkDebugf("%s tests=%d\n", __FUNCTION__, testsRun);
100 } 87 }
101 88
102 #include "TestClassDef.h" 89 #include "TestClassDef.h"
103 DEFINE_TESTCLASS("PathOpsSimplifyQuadsThreaded", SimplifyQuadsThreadedTestClass, \ 90 DEFINE_TESTCLASS("PathOpsSimplifyQuadsThreaded", SimplifyQuadsThreadedTestClass, \
104 TestSimplifyQuadsThreaded) 91 TestSimplifyQuadsThreaded)
OLDNEW
« no previous file with comments | « tests/PathOpsSimplifyDegenerateThreadedTest.cpp ('k') | tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698