Flutter Engine
The Flutter Engine
Functions | Variables
PathOpsOpRectThreadedTest.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/pathops/SkPathOps.h"
#include "include/private/base/SkTDArray.h"
#include "src/pathops/SkPathOpsDebug.h"
#include "tests/PathOpsDebug.h"
#include "tests/PathOpsExtendedTest.h"
#include "tests/PathOpsThreadedCommon.h"
#include "tests/Test.h"
#include <atomic>
#include <initializer_list>

Go to the source code of this file.

Functions

static void testPathOpsRectsMain (PathOpsThreadState *data)
 
 DEF_TEST (PathOpsRectsThreaded, reporter)
 
static void testPathOpsFastMain (PathOpsThreadState *data)
 
 DEF_TEST (PathOpsFastThreaded, reporter)
 

Variables

static int loopNo = 6
 
static std::atomic< intgRectsTestNo {0}
 
static std::atomic< intgFastTestNo {0}
 

Function Documentation

◆ DEF_TEST() [1/2]

DEF_TEST ( PathOpsFastThreaded  ,
reporter   
)

Definition at line 192 of file PathOpsOpRectThreadedTest.cpp.

192 {
193 initializeTests(reporter, "testOp");
195 int step = reporter->allowExtendedTest() ? 2 : 5;
196 for (int a = 0; a < 6; a += step) { // outermost
197 for (int b = a + 1; b < 7; b += step) {
198 for (int c = 0 ; c < 6; c += step) {
199 for (int d = c + 1; d < 7; d += step) {
200 *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
201 &testPathOpsFastMain, a, b, c, d, &testRunner);
202 }
203 }
204 }
205 }
206 testRunner.render();
207}
static int step(int x, SkScalar min, SkScalar max)
Definition: BlurTest.cpp:215
reporter
Definition: FontMgrTest.cpp:39
void initializeTests(skiatest::Reporter *reporter, const char *test)
static void testPathOpsFastMain(PathOpsThreadState *data)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19
static bool b
struct MyStruct a[10]

◆ DEF_TEST() [2/2]

DEF_TEST ( PathOpsRectsThreaded  ,
reporter   
)

Definition at line 102 of file PathOpsOpRectThreadedTest.cpp.

102 {
103 initializeTests(reporter, "testOp");
105 for (int a = 0; a < 6; ++a) { // outermost
106 for (int b = a + 1; b < 7; ++b) {
107 for (int c = 0 ; c < 6; ++c) {
108 for (int d = c + 1; d < 7; ++d) {
109 *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
110 &testPathOpsRectsMain, a, b, c, d, &testRunner);
111 }
112 }
113 if (!reporter->allowExtendedTest()) goto finish;
114 }
115 }
116finish:
117 testRunner.render();
118}
static void testPathOpsRectsMain(PathOpsThreadState *data)

◆ testPathOpsFastMain()

static void testPathOpsFastMain ( PathOpsThreadState data)
static

Definition at line 122 of file PathOpsOpRectThreadedTest.cpp.

123{
124 SkASSERT(data);
125 const SkPathFillType fts[] = {
128 };
130 SkString pathStr;
131 int step = data->fReporter->allowExtendedTest() ? 2 : 5;
132 for (bool a : { false, true } ) {
133 for (bool b : { false, true } ) {
134 for (int c = 0; c < 6; c += step) {
135 for (int d = 0; d < 6; d += step) {
136 for (auto e : fts) {
137 for (auto f : fts) {
138 SkPath pathA, pathB;
139 pathA.setFillType(e);
140 if (a) {
143 }
144 pathA.close();
145 pathB.setFillType(f);
146 if (b) {
149 }
150 pathB.close();
151 const char* fillTypeStr[] = { "Winding", "EvenOdd", "InverseWinding", "InverseEvenOdd" };
152 for (int op = 0; op <= kXOR_SkPathOp; ++op) {
153 if (state.fReporter->verbose()) {
154 pathStr.printf(
155 "static void fast%d(skiatest::Reporter* reporter,"
156 "const char* filename) {\n", loopNo);
157 pathStr.appendf(" SkPath path, pathB;");
158 pathStr.appendf(" path.setFillType(SkPathFillType::k%s);\n", fillTypeStr[(int)e]);
159 if (a) {
160 pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
161 " SkPathDirection::kCW);\n", state.fA, state.fA, state.fB + c, state.fB);
162 }
163 pathStr.appendf(" path.setFillType(SkPathFillType::k%s);\n", fillTypeStr[(int)f]);
164 if (b) {
165 pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
166 " SkPathDirection::kCW);\n", state.fC, state.fC, state.fD + d, state.fD);
167 }
168 pathStr.appendf(" testPathOp(reporter, path, pathB, %s, filename);\n",
170 pathStr.appendf("}\n\n");
171 state.outputProgress(pathStr.c_str(), (SkPathOp) op);
172 }
174 testName.printf("fast%d", ++gFastTestNo);
175 if (!testPathOp(state.fReporter, pathA, pathB, (SkPathOp) op, testName.c_str())) {
176 if (state.fReporter->verbose()) {
177 ++loopNo;
178 goto skipToNext;
179 }
180 }
182 }
183 }
184 }
185skipToNext: ;
186 }
187 }
188 }
189 }
190}
bool testPathOp(skiatest::Reporter *reporter, const SkPath &a, const SkPath &b, const SkPathOp shapeOp, const char *testName)
static int loopNo
static std::atomic< int > gFastTestNo
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkPathOp
Definition: SkPathOps.h:22
@ kXOR_SkPathOp
exclusive-or the two paths
Definition: SkPathOps.h:26
SkPathFillType
Definition: SkPathTypes.h:11
#define SkIntToScalar(x)
Definition: SkScalar.h:57
static bool gCheckForDuplicateNames
Definition: PathOpsDebug.h:18
static const char * OpStr(SkPathOp)
Definition: SkPath.h:59
void setFillType(SkPathFillType ft)
Definition: SkPath.h:235
SkPath & close()
Definition: SkPath.cpp:823
SkPath & addRect(const SkRect &rect, SkPathDirection dir, unsigned start)
Definition: SkPath.cpp:864
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
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
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ testPathOpsRectsMain()

static void testPathOpsRectsMain ( PathOpsThreadState data)
static

Definition at line 33 of file PathOpsOpRectThreadedTest.cpp.

34{
38 SkString pathStr;
39 for (int a = 0 ; a < 6; ++a) {
40 for (int b = a + 1 ; b < 7; ++b) {
41 for (int c = 0 ; c < 6; ++c) {
42 for (int d = c + 1 ; d < 7; ++d) {
43 for (auto e : fts) {
44 for (auto f : fts) {
45 SkPath pathA, pathB;
51 pathA.close();
57 pathB.close();
58 for (int op = 0 ; op <= kXOR_SkPathOp; ++op) {
59 if (state.fReporter->verbose()) {
60 pathStr.printf(
61 "static void rects%d(skiatest::Reporter* reporter,"
62 "const char* filename) {\n", loopNo);
63 pathStr.appendf(" SkPath path, pathB;");
64 pathStr.appendf(" path.setFillType(SkPathFillType::k%s);\n",
66 ? "EvenOdd" : "?UNDEFINED");
67 pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
68 " SkPathDirection::kCW);\n", state.fA, state.fA, state.fB, state.fB);
69 pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
70 " SkPathDirection::kCW);\n", state.fC, state.fC, state.fD, state.fD);
71 pathStr.appendf(" pathB.setFillType(SkPathFillType::k%s);\n",
73 ? "EvenOdd" : "?UNDEFINED");
74 pathStr.appendf(" pathB.addRect(%d, %d, %d, %d,"
75 " SkPathDirection::kCW);\n", a, a, b, b);
76 pathStr.appendf(" pathB.addRect(%d, %d, %d, %d,"
77 " SkPathDirection::kCW);\n", c, c, d, d);
78 pathStr.appendf(" testPathOp(reporter, path, pathB, %s, filename);\n",
80 pathStr.appendf("}\n\n");
81 state.outputProgress(pathStr.c_str(), (SkPathOp) op);
82 }
84 testName.printf("thread_rects%d", ++gRectsTestNo);
85 if (!testPathOp(state.fReporter, pathA, pathB, (SkPathOp) op, testName.c_str())) {
86 if (state.fReporter->verbose()) {
87 ++loopNo;
88 goto skipToNext;
89 }
90 }
92 }
93 }
94 }
95skipToNext: ;
96 }
97 }
98 }
99 }
100}
static std::atomic< int > gRectsTestNo

Variable Documentation

◆ gFastTestNo

std::atomic<int> gFastTestNo {0}
static

Definition at line 120 of file PathOpsOpRectThreadedTest.cpp.

◆ gRectsTestNo

std::atomic<int> gRectsTestNo {0}
static

Definition at line 31 of file PathOpsOpRectThreadedTest.cpp.

◆ loopNo

int loopNo = 6
static

Definition at line 30 of file PathOpsOpRectThreadedTest.cpp.