Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
PathOpsSimplifyRectThreadedTest.cpp File Reference
#include "include/core/SkPath.h"
#include "include/core/SkPathTypes.h"
#include "include/core/SkScalar.h"
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkMacros.h"
#include "include/private/base/SkTDArray.h"
#include "tests/PathOpsExtendedTest.h"
#include "tests/PathOpsThreadedCommon.h"
#include "tests/Test.h"

Go to the source code of this file.

Functions

static void testSimplify4x4RectsMain (PathOpsThreadState *data)
 
 DEF_TEST (PathOpsSimplifyRectsThreaded, reporter)
 

Function Documentation

◆ DEF_TEST()

DEF_TEST ( PathOpsSimplifyRectsThreaded  ,
reporter   
)

Definition at line 197 of file PathOpsSimplifyRectThreadedTest.cpp.

197 {
198 initializeTests(reporter, "testLine");
200 for (int a = 0; a < 8; ++a) { // outermost
201 for (int b = a ; b < 8; ++b) {
202 for (int c = b ; c < 8; ++c) {
203 for (int d = c; d < 8; ++d) {
204 *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
205 &testSimplify4x4RectsMain, a, b, c, d, &testRunner);
206 }
207 if (!reporter->allowExtendedTest()) goto finish;
208 }
209 }
210 }
211finish:
212 testRunner.render();
213}
reporter
void initializeTests(skiatest::Reporter *reporter, const char *test)
static void testSimplify4x4RectsMain(PathOpsThreadState *data)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition main.cc:19
static bool b
struct MyStruct a[10]

◆ testSimplify4x4RectsMain()

static void testSimplify4x4RectsMain ( PathOpsThreadState data)
static

Definition at line 26 of file PathOpsSimplifyRectThreadedTest.cpp.

27{
28 SkASSERT(data);
30 int aShape = state.fA & 0x03;
32 int bShape = state.fB & 0x03;
34 int cShape = state.fC & 0x03;
36 int dShape = state.fD & 0x03;
38 for (int aXAlign = 0; aXAlign < 5; ++aXAlign) {
39 for (int aYAlign = 0; aYAlign < 5; ++aYAlign) {
40 for (int bXAlign = 0; bXAlign < 5; ++bXAlign) {
41 for (int bYAlign = 0; bYAlign < 5; ++bYAlign) {
42 for (int cXAlign = 0; cXAlign < 5; ++cXAlign) {
43 for (int cYAlign = 0; cYAlign < 5; ++cYAlign) {
44 for (int dXAlign = 0; dXAlign < 5; ++dXAlign) {
45 for (int dYAlign = 0; dYAlign < 5; ++dYAlign) {
46 SkString pathStr;
50 if (aShape) {
51 switch (aShape) {
52 case 1: // square
53 l = 0; r = 60;
54 t = 0; b = 60;
55 aXAlign = 5;
56 aYAlign = 5;
57 break;
58 case 2:
59 l = aXAlign * 12;
60 r = l + 30;
61 t = 0; b = 60;
62 aYAlign = 5;
63 break;
64 case 3:
65 l = 0; r = 60;
66 t = aYAlign * 12;
67 b = l + 30;
68 aXAlign = 5;
69 break;
70 }
72 aCW);
73 if (state.fReporter->verbose()) {
74 pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
75 " SkPathDirection::kC%sW);\n", l, t, r, b,
76 aCW == SkPathDirection::kCCW ? "C" : "");
77 }
78 } else {
79 aXAlign = 5;
80 aYAlign = 5;
81 }
82 if (bShape) {
83 switch (bShape) {
84 case 1: // square
85 l = bXAlign * 10;
86 r = l + 20;
87 t = bYAlign * 10;
88 b = l + 20;
89 break;
90 case 2:
91 l = bXAlign * 10;
92 r = l + 20;
93 t = 10; b = 40;
94 bYAlign = 5;
95 break;
96 case 3:
97 l = 10; r = 40;
98 t = bYAlign * 10;
99 b = l + 20;
100 bXAlign = 5;
101 break;
102 }
104 bCW);
105 if (state.fReporter->verbose()) {
106 pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
107 " SkPathDirection::kC%sW);\n", l, t, r, b,
108 bCW == SkPathDirection::kCCW ? "C" : "");
109 }
110 } else {
111 bXAlign = 5;
112 bYAlign = 5;
113 }
114 if (cShape) {
115 switch (cShape) {
116 case 1: // square
117 l = cXAlign * 6;
118 r = l + 12;
119 t = cYAlign * 6;
120 b = l + 12;
121 break;
122 case 2:
123 l = cXAlign * 6;
124 r = l + 12;
125 t = 20; b = 30;
126 cYAlign = 5;
127 break;
128 case 3:
129 l = 20; r = 30;
130 t = cYAlign * 6;
131 b = l + 20;
132 cXAlign = 5;
133 break;
134 }
136 cCW);
137 if (state.fReporter->verbose()) {
138 pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
139 " SkPathDirection::kC%sW);\n", l, t, r, b,
140 cCW == SkPathDirection::kCCW ? "C" : "");
141 }
142 } else {
143 cXAlign = 5;
144 cYAlign = 5;
145 }
146 if (dShape) {
147 switch (dShape) {
148 case 1: // square
149 l = dXAlign * 4;
150 r = l + 9;
151 t = dYAlign * 4;
152 b = l + 9;
153 break;
154 case 2:
155 l = dXAlign * 6;
156 r = l + 9;
157 t = 32; b = 36;
158 dYAlign = 5;
159 break;
160 case 3:
161 l = 32; r = 36;
162 t = dYAlign * 6;
163 b = l + 9;
164 dXAlign = 5;
165 break;
166 }
168 dCW);
169 if (state.fReporter->verbose()) {
170 pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
171 " SkPathDirection::kC%sW);\n", l, t, r, b,
172 dCW == SkPathDirection::kCCW ? "C" : "");
173 }
174 } else {
175 dXAlign = 5;
176 dYAlign = 5;
177 }
178 path.close();
179 if (state.fReporter->verbose()) {
180 state.outputProgress(pathStr.c_str(), SkPathFillType::kWinding);
181 }
182 testSimplify(path, false, out, state, pathStr.c_str());
183 if (state.fReporter->verbose()) {
184 state.outputProgress(pathStr.c_str(), SkPathFillType::kEvenOdd);
185 }
186 testSimplify(path, true, out, state, pathStr.c_str());
187 }
188 }
189 }
190 }
191 }
192 }
193 }
194 }
195}
bool testSimplify(SkPath &path, bool useXor, SkPath &out, PathOpsThreadState &state, const char *pathStr)
#define SkASSERT(cond)
Definition SkAssert.h:116
#define SK_INIT_TO_AVOID_WARNING
Definition SkMacros.h:58
SkPathDirection
Definition SkPathTypes.h:34
#define SkIntToScalar(x)
Definition SkScalar.h:57
const char * c_str() const
Definition SkString.h:133
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
Definition SkString.cpp:550
AtkStateType state
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41