OLD | NEW |
| (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 "EdgeWalker_Test.h" | |
8 #include "Intersection_Tests.h" | |
9 #include "SkBitmap.h" | |
10 #include "SkCanvas.h" | |
11 | |
12 | |
13 static void* testSimplify4x4QuadraticsMain(void* data) | |
14 { | |
15 SkASSERT(data); | |
16 State4& state = *(State4*) data; | |
17 char pathStr[1024]; | |
18 bzero(pathStr, sizeof(pathStr)); | |
19 do { | |
20 int ax = state.a & 0x03; | |
21 int ay = state.a >> 2; | |
22 int bx = state.b & 0x03; | |
23 int by = state.b >> 2; | |
24 int cx = state.c & 0x03; | |
25 int cy = state.c >> 2; | |
26 int dx = state.d & 0x03; | |
27 int dy = state.d >> 2; | |
28 for (int e = 0 ; e < 16; ++e) { | |
29 int ex = e & 0x03; | |
30 int ey = e >> 2; | |
31 for (int f = e ; f < 16; ++f) { | |
32 int fx = f & 0x03; | |
33 int fy = f >> 2; | |
34 for (int g = f ; g < 16; ++g) { | |
35 int gx = g & 0x03; | |
36 int gy = g >> 2; | |
37 for (int h = g ; h < 16; ++h) { | |
38 int hx = h & 0x03; | |
39 int hy = h >> 2; | |
40 SkPath path, out; | |
41 path.setFillType(SkPath::kWinding_FillType); | |
42 path.moveTo(ax, ay); | |
43 path.quadTo(bx, by, cx, cy); | |
44 path.lineTo(dx, dy); | |
45 path.close(); | |
46 path.moveTo(ex, ey); | |
47 path.lineTo(fx, fy); | |
48 path.quadTo(gx, gy, hx, hy); | |
49 path.close(); | |
50 if (1) { // gdb: set print elements 400 | |
51 char* str = pathStr; | |
52 str += sprintf(str, " path.moveTo(%d, %d);\n", ax
, ay); | |
53 str += sprintf(str, " path.quadTo(%d, %d, %d, %d)
;\n", bx, by, cx, cy); | |
54 str += sprintf(str, " path.lineTo(%d, %d);\n", dx
, dy); | |
55 str += sprintf(str, " path.close();\n"); | |
56 str += sprintf(str, " path.moveTo(%d, %d);\n", ex
, ey); | |
57 str += sprintf(str, " path.lineTo(%d, %d);\n", fx
, fy); | |
58 str += sprintf(str, " path.quadTo(%d, %d, %d, %d)
;\n", gx, gy, hx, hy); | |
59 str += sprintf(str, " path.close();\n"); | |
60 } | |
61 outputProgress(state, pathStr, SkPath::kWinding_FillType
); | |
62 testSimplifyx(path, false, out, state, pathStr); | |
63 state.testsRun++; | |
64 path.setFillType(SkPath::kEvenOdd_FillType); | |
65 outputProgress(state, pathStr, SkPath::kEvenOdd_FillType
); | |
66 testSimplifyx(path, true, out, state, pathStr); | |
67 state.testsRun++; | |
68 } | |
69 } | |
70 } | |
71 } | |
72 } while (runNextTestSet(state)); | |
73 return NULL; | |
74 } | |
75 | |
76 void Simplify4x4QuadraticsThreaded_Test(int& testsRun) | |
77 { | |
78 SkDebugf("%s\n", __FUNCTION__); | |
79 #ifdef SK_DEBUG | |
80 gDebugMaxWindSum = 4; // FIXME: 3? | |
81 gDebugMaxWindValue = 4; | |
82 #endif | |
83 const char testStr[] = "testQuadratic"; | |
84 initializeTests(testStr, sizeof(testStr)); | |
85 int testsStart = testsRun; | |
86 int a = 0; | |
87 #define SKIP_A 0 | |
88 #if SKIP_A | |
89 a = 2; | |
90 #endif | |
91 for (; a < 16; ++a) { | |
92 for (int b = a ; b < 16; ++b) { | |
93 for (int c = b ; c < 16; ++c) { | |
94 for (int d = c; d < 16; ++d) { | |
95 testsRun += dispatchTest4(testSimplify4x4QuadraticsMain, | |
96 a, b, c, d); | |
97 } | |
98 if (!gRunTestsInOneThread) SkDebugf("."); | |
99 } | |
100 if (!gRunTestsInOneThread) SkDebugf("%d", b); | |
101 } | |
102 if (!gRunTestsInOneThread) SkDebugf("\n%d", a); | |
103 } | |
104 testsRun += waitForCompletion(); | |
105 SkDebugf("%s tests=%d total=%d\n", __FUNCTION__, testsRun - testsStart, test
sRun); | |
106 } | |
OLD | NEW |