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

Side by Side Diff: tests/PathOpsOpCubicThreadedTest.cpp

Issue 13094010: Add implementation of path ops (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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/PathOpsExtendedTest.cpp ('k') | tests/PathOpsOpRectThreadedTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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* testOpCubicsMain(void* data)
10 {
11 SkASSERT(data);
12 State4& state = *(State4*) data;
13 char pathStr[1024]; // gdb: set print elements 400
14 bzero(pathStr, sizeof(pathStr));
15 do {
16 for (int a = 0 ; a < 6; ++a) {
17 for (int b = a + 1 ; b < 7; ++b) {
18 for (int c = 0 ; c < 6; ++c) {
19 for (int d = c + 1 ; d < 7; ++d) {
20 for (int e = SkPath::kWinding_FillType ; e <= SkPath::kEvenOdd_FillType; ++e) {
21 for (int f = SkPath::kWinding_FillType ; f <= SkPath::kEvenOdd_FillType; ++f) {
22 SkPath pathA, pathB;
23 char* str = pathStr;
24 pathA.setFillType((SkPath::FillType) e);
25 str += sprintf(str, " path.setFillType(SkPath::k%s_FillType);\n",
26 e == SkPath::kWinding_FillType ? "Winding" : e == SkPath::kE venOdd_FillType
27 ? "EvenOdd" : "?UNDEFINED");
28 pathA.moveTo(state.a, state.b);
29 str += sprintf(str, " path.moveTo(%d,%d);\n", state.a, state.b);
30 pathA.cubicTo(state.c, state.d, b, a, d, c);
31 str += sprintf(str, " path.cubicTo(%d,%d, %d,%d, %d,%d);\n", stat e.c, state.d,
32 b, a, d, c);
33 pathA.close();
34 str += sprintf(str, " path.close();\n");
35 pathB.setFillType((SkPath::FillType) f);
36 str += sprintf(str, " pathB.setFillType(SkPath::k%s_FillType);\n" ,
37 f == SkPath::kWinding_FillType ? "Winding" : f == SkPath::kE venOdd_FillType
38 ? "EvenOdd" : "?UNDEFINED");
39 pathB.moveTo(a, b);
40 str += sprintf(str, " pathB.moveTo(%d,%d);\n", a, b);
41 pathB.cubicTo(c, d, state.b, state.a, state.d, state.c);
42 str += sprintf(str, " pathB.cubicTo(%d,%d, %d,%d, %d,%d);\n", c, d,
43 state.b, state.a, state.d, state.c);
44 pathB.close();
45 str += sprintf(str, " pathB.close();\n");
46 for (int op = 0 ; op <= kXOR_PathOp; ++op) {
47 outputProgress(state, pathStr, (SkPathOp) op);
48 testPathOp(state.reporter, pathA, pathB, (SkPathOp) op);
49 state.testsRun++;
50 }
51 }
52 }
53 }
54 }
55 }
56 }
57 } while (runNextTestSet(state));
58 return NULL;
59 }
60
61 static void TestOpCubicsThreaded(skiatest::Reporter* reporter)
62 {
63 int testsRun = 0;
64 if (gShowTestProgress) SkDebugf("%s\n", __FUNCTION__);
65 #ifdef SK_DEBUG
66 gDebugMaxWindSum = 4;
67 gDebugMaxWindValue = 4;
68 #endif
69 const char testLineStr[] = "cubicOp";
70 initializeTests(reporter, testLineStr, sizeof(testLineStr));
71 for (int a = 0; a < 6; ++a) { // outermost
72 for (int b = a + 1; b < 7; ++b) {
73 for (int c = 0 ; c < 6; ++c) {
74 for (int d = c + 1; d < 7; ++d) {
75 testsRun += dispatchTest4(testOpCubicsMain, a, b, c, d);
76 }
77 if (gShowTestProgress) SkDebugf(".");
78 }
79 if (!gAllowExtendedTest) goto finish;
80 if (gShowTestProgress) SkDebugf("%d", b);
81 }
82 if (gShowTestProgress) SkDebugf("\n%d", a);
83 }
84 finish:
85 testsRun += waitForCompletion();
86 if (gShowTestProgress) SkDebugf("%s tests=%d\n", __FUNCTION__, testsRun);
87 }
88
89 #include "TestClassDef.h"
90 DEFINE_TESTCLASS("PathOpsOpCubicsThreaded", OpCubicsThreadedTestClass, \
91 TestOpCubicsThreaded)
OLDNEW
« no previous file with comments | « tests/PathOpsExtendedTest.cpp ('k') | tests/PathOpsOpRectThreadedTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698