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

Side by Side Diff: experimental/Intersection/ShapeOpCubic4x4_Test.cpp

Issue 867213004: remove prototype pathops code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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
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 "EdgeWalker_Test.h"
8 #include "Intersection_Tests.h"
9 #include "ShapeOps.h"
10
11 // four rects, of four sizes
12 // for 3 smaller sizes, tall, wide
13 // top upper mid lower bottom aligned (3 bits, 5 values)
14 // same with x (3 bits, 5 values)
15 // not included, square, tall, wide (2 bits)
16 // cw or ccw (1 bit)
17
18 int failSet[][8] = {
19 { 0, 1, 0, 6, 2, 3, 1, 4 }
20 };
21
22 static void* testShapeOps4x4CubicsMain(void* data)
23 {
24 SkASSERT(data);
25 State4& state = *(State4*) data;
26 char pathStr[1024]; // gdb: set print elements 400
27 bzero(pathStr, sizeof(pathStr));
28 do {
29 for (int a = 0 ; a < 6; ++a) {
30 for (int b = a + 1 ; b < 7; ++b) {
31 for (int c = 0 ; c < 6; ++c) {
32 for (int d = c + 1 ; d < 7; ++d) {
33 for (int e = SkPath::kWinding_FillType ; e <= SkPath::kEvenOdd_FillType; ++e) {
34 for (int f = SkPath::kWinding_FillType ; f <= SkPath::kEvenOdd_FillType; ++f) {
35
36 #if 0
37 if (state.a == fail[0] && state.b == fail[1] && state.c == fail[2] && state.d == fail[3]
38 && a == fail[4] && b == fail[5] && c == fail[6] && d == fail[7]) {
39 SkDebugf("skip failing case\n");
40 }
41 // skip this troublesome cubic pair
42 #endif
43 SkPath pathA, pathB;
44 char* str = pathStr;
45 pathA.setFillType((SkPath::FillType) e);
46 str += sprintf(str, " path.setFillType(SkPath::k%s_FillType);\n",
47 e == SkPath::kWinding_FillType ? "Winding" : e == SkPath::kE venOdd_FillType
48 ? "EvenOdd" : "?UNDEFINED");
49 pathA.moveTo(state.a, state.b);
50 str += sprintf(str, " path.moveTo(%d,%d);\n", state.a, state.b);
51 pathA.cubicTo(state.c, state.d, b, a, d, c);
52 str += sprintf(str, " path.cubicTo(%d,%d, %d,%d, %d,%d);\n", stat e.c, state.d,
53 b, a, d, c);
54 pathA.close();
55 str += sprintf(str, " path.close();\n");
56 pathB.setFillType((SkPath::FillType) f);
57 str += sprintf(str, " pathB.setFillType(SkPath::k%s_FillType);\n" ,
58 f == SkPath::kWinding_FillType ? "Winding" : f == SkPath::kE venOdd_FillType
59 ? "EvenOdd" : "?UNDEFINED");
60 pathB.moveTo(a, b);
61 str += sprintf(str, " pathB.moveTo(%d,%d);\n", a, b);
62 pathB.cubicTo(c, d, state.b, state.a, state.d, state.c);
63 str += sprintf(str, " pathB.cubicTo(%d,%d, %d,%d, %d,%d);\n", c, d,
64 state.b, state.a, state.d, state.c);
65 pathB.close();
66 str += sprintf(str, " pathB.close();\n");
67 for (int op = 0 ; op < kShapeOp_Count; ++op) {
68 outputProgress(state, pathStr, (ShapeOp) op);
69 testShapeOp(pathA, pathB, (ShapeOp) op);
70 state.testsRun++;
71 }
72 }
73 }
74 }
75 }
76 }
77 }
78 } while (runNextTestSet(state));
79 return NULL;
80 }
81
82 void ShapeOps4x4CubicsThreaded_Test(int& testsRun)
83 {
84 SkDebugf("%s\n", __FUNCTION__);
85 #ifdef SK_DEBUG
86 gDebugMaxWindSum = 4;
87 gDebugMaxWindValue = 4;
88 #endif
89 const char testLineStr[] = "cubicOp";
90 initializeTests(testLineStr, sizeof(testLineStr));
91 int testsStart = testsRun;
92 for (int a = 0; a < 6; ++a) { // outermost
93 for (int b = a + 1; b < 7; ++b) {
94 for (int c = 0 ; c < 6; ++c) {
95 for (int d = c + 1; d < 7; ++d) {
96 testsRun += dispatchTest4(testShapeOps4x4CubicsMain, 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 }
OLDNEW
« no previous file with comments | « experimental/Intersection/QuarticRoot_Test.cpp ('k') | experimental/Intersection/ShapeOpRect4x4_Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698