Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
PathOpsOpCircleThreadedTest.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2015 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
16#include "tests/PathOpsDebug.h"
19#include "tests/Test.h"
20
21#include <atomic>
22
23static int loopNo = 4;
24static std::atomic<int> gCirclesTestNo{0};
25
27 SkASSERT(data);
30 SkString pathStr;
31 for (int a = 0 ; a < 6; ++a) {
32 for (int b = a + 1 ; b < 7; ++b) {
33 for (int c = 0 ; c < 6; ++c) {
34 for (int d = c + 1 ; d < 7; ++d) {
35 for (auto e : fts) {
36 for (auto f : fts) {
37 SkPath pathA, pathB;
38 pathA.setFillType(e);
41 pathB.setFillType(f);
44 for (int op = 0 ; op <= kXOR_SkPathOp; ++op) {
45 if (state.fReporter->verbose()) {
46 pathStr.printf("static void circlesOp%d(skiatest::Reporter* reporter,"
47 " const char* filename) {\n", loopNo);
48 pathStr.appendf(" SkPath path, pathB;\n");
49 pathStr.appendf(" path.setFillType(SkPathFillType::k%s);\n",
51 ? "EvenOdd" : "?UNDEFINED");
52 pathStr.appendf(" path.addCircle(%d, %d, %d, %s);\n", state.fA, state.fB,
53 state.fC, state.fD ? "SkPathDirection::kCW" : "SkPathDirection::kCCW");
54 pathStr.appendf(" pathB.setFillType(SkPathFillType::k%s);\n",
56 ? "EvenOdd" : "?UNDEFINED");
57 pathStr.appendf(" pathB.addCircle(%d, %d, %d, %s);\n", a, b,
58 c, d ? "SkPathDirection::kCW" : "SkPathDirection::kCCW");
59 pathStr.appendf(" testPathOp(reporter, path, pathB, %s, filename);\n",
61 pathStr.appendf("}\n");
62 state.outputProgress(pathStr.c_str(), (SkPathOp) op);
63 }
64 SkString testName;
65 testName.printf("thread_circles%d", ++gCirclesTestNo);
66 if (!testPathOp(state.fReporter, pathA, pathB, (SkPathOp) op, testName.c_str())) {
67 if (state.fReporter->verbose()) {
68 ++loopNo;
69 goto skipToNext;
70 }
71 }
73 }
74 }
75 }
76skipToNext: ;
77 }
78 }
79 }
80 }
81}
82
83DEF_TEST(PathOpsOpCircleThreaded, reporter) {
84 initializeTests(reporter, "circleOp");
86 for (int a = 0; a < 6; ++a) { // outermost
87 for (int b = a + 1; b < 7; ++b) {
88 for (int c = 0 ; c < 6; ++c) {
89 for (int d = 0; d < 2; ++d) {
90 *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
91 &testOpCirclesMain, a, b, c, d, &testRunner);
92 }
93 }
94 if (!reporter->allowExtendedTest()) goto finish;
95 }
96 }
97finish:
98 testRunner.render();
99}
reporter
bool testPathOp(skiatest::Reporter *reporter, const SkPath &a, const SkPath &b, const SkPathOp shapeOp, const char *testName)
void initializeTests(skiatest::Reporter *reporter, const char *test)
static int loopNo
static std::atomic< int > gCirclesTestNo
static void testOpCirclesMain(PathOpsThreadState *data)
#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
#define DEF_TEST(name, reporter)
Definition Test.h:312
static bool gCheckForDuplicateNames
SkTDArray< PathOpsThreadedRunnable * > fRunnables
static const char * OpStr(SkPathOp)
SkPath & addCircle(SkScalar x, SkScalar y, SkScalar radius, SkPathDirection dir=SkPathDirection::kCW)
Definition SkPath.cpp:1149
void setFillType(SkPathFillType ft)
Definition SkPath.h:235
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
T * append()
Definition SkTDArray.h:191
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition main.cc:19
static bool b
struct MyStruct a[10]
AtkStateType state