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

Side by Side Diff: tests/PathOpsOpCubicThreadedTest.cpp

Issue 1096923003: working on initial winding for cubics (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « tests/PathOpsIssue3651.cpp ('k') | tests/PathOpsOpLoopThreadedTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "PathOpsThreadedCommon.h"
9 9
10 static int loopNo = 132;
11
10 static void testOpCubicsMain(PathOpsThreadState* data) { 12 static void testOpCubicsMain(PathOpsThreadState* data) {
11 #if DEBUG_SHOW_TEST_NAME 13 #if DEBUG_SHOW_TEST_NAME
12 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); 14 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
13 #endif 15 #endif
14 SkASSERT(data); 16 SkASSERT(data);
15 PathOpsThreadState& state = *data; 17 PathOpsThreadState& state = *data;
16 char pathStr[1024]; // gdb: set print elements 400 18 char pathStr[1024]; // gdb: set print elements 400
17 bool progress = state.fReporter->verbose(); // FIXME: break out into its own parameter? 19 bool progress = state.fReporter->verbose(); // FIXME: break out into its own parameter?
18 if (progress) { 20 if (progress) {
19 sk_bzero(pathStr, sizeof(pathStr)); 21 sk_bzero(pathStr, sizeof(pathStr));
20 } 22 }
21 for (int a = 0 ; a < 6; ++a) { 23 for (int a = 0 ; a < 6; ++a) {
22 for (int b = a + 1 ; b < 7; ++b) { 24 for (int b = a + 1 ; b < 7; ++b) {
23 for (int c = 0 ; c < 6; ++c) { 25 for (int c = 0 ; c < 6; ++c) {
24 for (int d = c + 1 ; d < 7; ++d) { 26 for (int d = c + 1 ; d < 7; ++d) {
25 for (int e = SkPath::kWinding_FillType ; e <= SkPath::kEvenO dd_FillType; ++e) { 27 for (int e = SkPath::kWinding_FillType ; e <= SkPath::kEvenO dd_FillType; ++e) {
26 for (int f = SkPath::kWinding_FillType ; f <= SkPath::kEvenOdd_FillType; ++f ) { 28 for (int f = SkPath::kWinding_FillType ; f <= SkPath::kEvenOdd_FillType; ++f ) {
27 SkPath pathA, pathB; 29 SkPath pathA, pathB;
28 if (progress) {
29 char* str = pathStr;
30 const int loopNo = 133;
31 str += sprintf(str, "static void cubicOp%d(skiatest::Reporter* repor ter,"
32 " const char* filename) {\n", loopNo);
33 str += sprintf(str, " SkPath path, pathB;\n");
34 str += sprintf(str, " path.setFillType(SkPath::k%s_FillType);\n",
35 e == SkPath::kWinding_FillType ? "Winding" : e == SkPath::kE venOdd_FillType
36 ? "EvenOdd" : "?UNDEFINED");
37 str += sprintf(str, " path.moveTo(%d,%d);\n", state.fA, state.fB) ;
38 str += sprintf(str, " path.cubicTo(%d,%d, %d,%d, %d,%d);\n", stat e.fC, state.fD,
39 b, a, d, c);
40 str += sprintf(str, " path.close();\n");
41 str += sprintf(str, " pathB.setFillType(SkPath::k%s_FillType);\n" ,
42 f == SkPath::kWinding_FillType ? "Winding" : f == SkPath::kE venOdd_FillType
43 ? "EvenOdd" : "?UNDEFINED");
44 str += sprintf(str, " pathB.moveTo(%d,%d);\n", a, b);
45 str += sprintf(str, " pathB.cubicTo(%d,%d, %d,%d, %d,%d);\n", c, d,
46 state.fB, state.fA, state.fD, state.fC);
47 str += sprintf(str, " pathB.close();\n");
48 str += sprintf(str, " testPathOp(reporter, path, pathB, kDifferen ce_SkPathOp,"
49 " filename);\n");
50 str += sprintf(str, "}\n");
51 }
52 pathA.setFillType((SkPath::FillType) e); 30 pathA.setFillType((SkPath::FillType) e);
53 pathA.moveTo(SkIntToScalar(state.fA), SkIntToScalar(state.fB)); 31 pathA.moveTo(SkIntToScalar(state.fA), SkIntToScalar(state.fB));
54 pathA.cubicTo(SkIntToScalar(state.fC), SkIntToScalar(state.fD), SkIntToS calar(b), 32 pathA.cubicTo(SkIntToScalar(state.fC), SkIntToScalar(state.fD), SkIntToS calar(b),
55 SkIntToScalar(a), SkIntToScalar(d), SkIntToScalar(c)); 33 SkIntToScalar(a), SkIntToScalar(d), SkIntToScalar(c));
56 pathA.close(); 34 pathA.close();
57 pathB.setFillType((SkPath::FillType) f); 35 pathB.setFillType((SkPath::FillType) f);
58 pathB.moveTo(SkIntToScalar(a), SkIntToScalar(b)); 36 pathB.moveTo(SkIntToScalar(a), SkIntToScalar(b));
59 pathB.cubicTo(SkIntToScalar(c), SkIntToScalar(d), SkIntToScalar(state.fB ), 37 pathB.cubicTo(SkIntToScalar(c), SkIntToScalar(d), SkIntToScalar(state.fB ),
60 SkIntToScalar(state.fA), SkIntToScalar(state.fD), SkIntToScalar( state.fC)); 38 SkIntToScalar(state.fA), SkIntToScalar(state.fD), SkIntToScalar( state.fC));
61 pathB.close(); 39 pathB.close();
62 for (int op = 0 ; op <= kXOR_SkPathOp; ++op) { 40 for (int op = 0 ; op <= kXOR_SkPathOp; ++op) {
63 if (progress) { 41 if (progress) {
64 outputProgress(state.fPathStr, pathStr, (SkPathOp) op); 42 outputProgress(state.fPathStr, pathStr, (SkPathOp) op);
65 } 43 }
66 testThreadedPathOp(state.fReporter, pathA, pathB, (SkPathOp) op, "cu bics"); 44 if (progress) {
45 char* str = pathStr;
46 str += sprintf(str, "static void cubicOp%d(skiatest::Reporter* r eporter,"
47 " const char* filename) {\n", loopNo);
48 str += sprintf(str, " SkPath path, pathB;\n");
49 str += sprintf(str, " path.setFillType(SkPath::k%s_FillType); \n",
50 e == SkPath::kWinding_FillType ? "Winding" : e == SkPath ::kEvenOdd_FillType
51 ? "EvenOdd" : "?UNDEFINED");
52 str += sprintf(str, " path.moveTo(%d,%d);\n", state.fA, state .fB);
53 str += sprintf(str, " path.cubicTo(%d,%d, %d,%d, %d,%d);\n", state.fC, state.fD,
54 b, a, d, c);
55 str += sprintf(str, " path.close();\n");
56 str += sprintf(str, " pathB.setFillType(SkPath::k%s_FillType) ;\n",
57 f == SkPath::kWinding_FillType ? "Winding" : f == SkPath ::kEvenOdd_FillType
58 ? "EvenOdd" : "?UNDEFINED");
59 str += sprintf(str, " pathB.moveTo(%d,%d);\n", a, b);
60 str += sprintf(str, " pathB.cubicTo(%d,%d, %d,%d, %d,%d);\n", c, d,
61 state.fB, state.fA, state.fD, state.fC);
62 str += sprintf(str, " pathB.close();\n");
63 str += sprintf(str, " testPathOp(reporter, path, pathB, %s, f ilename);\n",
64 SkPathOpsDebug::OpStr((SkPathOp) op));
65 str += sprintf(str, "}\n");
66 }
67 if (!testThreadedPathOp(state.fReporter, pathA, pathB, (SkPathOp) op , "cubics")) {
68 if (progress) {
69 ++loopNo;
70 goto skipToNext;
71 }
72 }
67 } 73 }
68 } 74 }
69 } 75 }
76 skipToNext: ;
70 } 77 }
71 } 78 }
72 } 79 }
73 } 80 }
74 } 81 }
75 82
76 DEF_TEST(PathOpsOpCubicsThreaded, reporter) { 83 DEF_TEST(PathOpsOpCubicsThreaded, reporter) {
77 initializeTests(reporter, "cubicOp"); 84 initializeTests(reporter, "cubicOp");
78 PathOpsThreadedTestRunner testRunner(reporter); 85 PathOpsThreadedTestRunner testRunner(reporter);
79 for (int a = 0; a < 6; ++a) { // outermost 86 for (int a = 0; a < 6; ++a) { // outermost
80 for (int b = a + 1; b < 7; ++b) { 87 for (int b = a + 1; b < 7; ++b) {
81 for (int c = 0 ; c < 6; ++c) { 88 for (int c = 0 ; c < 6; ++c) {
82 for (int d = c + 1; d < 7; ++d) { 89 for (int d = c + 1; d < 7; ++d) {
83 *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreaded Runnable, 90 *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreaded Runnable,
84 (&testOpCubicsMain, a, b, c, d, &testRunner)); 91 (&testOpCubicsMain, a, b, c, d, &testRunner));
85 } 92 }
86 } 93 }
87 if (!reporter->allowExtendedTest()) goto finish; 94 if (!reporter->allowExtendedTest()) goto finish;
88 } 95 }
89 } 96 }
90 finish: 97 finish:
91 testRunner.render(); 98 testRunner.render();
92 ShowTestArray("cubicOp"); 99 ShowTestArray("cubicOp");
93 } 100 }
OLDNEW
« no previous file with comments | « tests/PathOpsIssue3651.cpp ('k') | tests/PathOpsOpLoopThreadedTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698