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

Side by Side Diff: tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp

Issue 13094010: Add implementation of path ops (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
« no previous file with comments | « tests/PathOpsSimplifyQuadThreadedTest.cpp ('k') | tests/PathOpsSimplifyRectThreadedTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:executable
+ *
OLDNEW
(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 static void* testSimplifyQuadralateralsMain(void* data)
10 {
11 SkASSERT(data);
12 State4& state = *(State4*) data;
13 char pathStr[1024];
14 bzero(pathStr, sizeof(pathStr));
15 do {
16 int ax = state.a & 0x03;
17 int ay = state.a >> 2;
18 int bx = state.b & 0x03;
19 int by = state.b >> 2;
20 int cx = state.c & 0x03;
21 int cy = state.c >> 2;
22 int dx = state.d & 0x03;
23 int dy = state.d >> 2;
24 for (int e = 0 ; e < 16; ++e) {
25 int ex = e & 0x03;
26 int ey = e >> 2;
27 for (int f = e ; f < 16; ++f) {
28 int fx = f & 0x03;
29 int fy = f >> 2;
30 for (int g = f ; g < 16; ++g) {
31 int gx = g & 0x03;
32 int gy = g >> 2;
33 for (int h = g ; h < 16; ++h) {
34 int hx = h & 0x03;
35 int hy = h >> 2;
36 SkPath path, out;
37 path.setFillType(SkPath::kWinding_FillType);
38 path.moveTo(ax, ay);
39 path.lineTo(bx, by);
40 path.lineTo(cx, cy);
41 path.lineTo(dx, dy);
42 path.close();
43 path.moveTo(ex, ey);
44 path.lineTo(fx, fy);
45 path.lineTo(gx, gy);
46 path.lineTo(hx, hy);
47 path.close();
48 if (1) { // gdb: set print elements 400
49 char* str = pathStr;
50 str += sprintf(str, " path.moveTo(%d, %d);\n", ax , ay);
51 str += sprintf(str, " path.lineTo(%d, %d);\n", bx , by);
52 str += sprintf(str, " path.lineTo(%d, %d);\n", cx , cy);
53 str += sprintf(str, " path.lineTo(%d, %d);\n", dx , dy);
54 str += sprintf(str, " path.close();\n");
55 str += sprintf(str, " path.moveTo(%d, %d);\n", ex , ey);
56 str += sprintf(str, " path.lineTo(%d, %d);\n", fx , fy);
57 str += sprintf(str, " path.lineTo(%d, %d);\n", gx , gy);
58 str += sprintf(str, " path.lineTo(%d, %d);\n", hx , hy);
59 str += sprintf(str, " path.close();\n");
60 }
61 outputProgress(state, pathStr, SkPath::kWinding_FillType );
62 testSimplify(path, false, out, state, pathStr);
63 state.testsRun++;
64 path.setFillType(SkPath::kEvenOdd_FillType);
65 outputProgress(state, pathStr, SkPath::kEvenOdd_FillType );
66 testSimplify(path, true, out, state, pathStr);
67 state.testsRun++;
68 }
69 }
70 }
71 }
72 } while (runNextTestSet(state));
73 return NULL;
74 }
75
76 static void TestSimplifyQuadralateralsThreaded(skiatest::Reporter* reporter)
77 {
78 int testsRun = 0;
79 if (gShowTestProgress) SkDebugf("%s\n", __FUNCTION__);
80 #ifdef SK_DEBUG
81 gDebugMaxWindSum = 4; // FIXME: 3?
82 gDebugMaxWindValue = 4;
83 #endif
84 const char testStr[] = "testQuadralaterals";
85 initializeTests(reporter, testStr, sizeof(testStr));
86 for (int a = 0; a < 16; ++a) {
87 for (int b = a ; b < 16; ++b) {
88 for (int c = b ; c < 16; ++c) {
89 for (int d = c; d < 16; ++d) {
90 testsRun += dispatchTest4(testSimplifyQuadralateralsMain, a, b, c, d);
91 }
92 if (!gAllowExtendedTest) goto finish;
93 if (gShowTestProgress) SkDebugf(".");
94 }
95 if (gShowTestProgress) SkDebugf("%d", b);
96 }
97 if (gShowTestProgress) SkDebugf("\n%d", a);
98 }
99 finish:
100 testsRun += waitForCompletion();
101 if (gShowTestProgress) SkDebugf("%s tests=%d\n", __FUNCTION__, testsRun);
102 }
103
104 #include "TestClassDef.h"
105 DEFINE_TESTCLASS("SimplifyQuadralateralsThreaded", SimplifyQuadralateralsThreade dTestClass, \
106 TestSimplifyQuadralateralsThreaded)
OLDNEW
« no previous file with comments | « tests/PathOpsSimplifyQuadThreadedTest.cpp ('k') | tests/PathOpsSimplifyRectThreadedTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698