Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
PathOpsSimplifyDegenerateThreadedTest.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/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 testSimplifyDegeneratesMain (PathOpsThreadState *data)
 
 DEF_TEST (PathOpsSimplifyDegeneratesThreaded, reporter)
 

Function Documentation

◆ DEF_TEST()

DEF_TEST ( PathOpsSimplifyDegeneratesThreaded  ,
reporter   
)

Definition at line 71 of file PathOpsSimplifyDegenerateThreadedTest.cpp.

71 {
72 initializeTests(reporter, "testDegenerates");
74 for (int a = 0; a < 16; ++a) {
75 int ax = a & 0x03;
76 int ay = a >> 2;
77 for (int b = a ; b < 16; ++b) {
78 int bx = b & 0x03;
79 int by = b >> 2;
80 for (int c = a ; c < 16; ++c) {
81 int cx = c & 0x03;
82 int cy = c >> 2;
83 bool abcIsATriangle = (bx - ax) * (cy - ay) != (by - ay) * (cx - ax);
84 *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
85 &testSimplifyDegeneratesMain, a, b, c, abcIsATriangle, &testRunner);
86 }
87 if (!reporter->allowExtendedTest()) goto finish;
88 }
89 }
90finish:
91 testRunner.render();
92}
reporter
void initializeTests(skiatest::Reporter *reporter, const char *test)
static void testSimplifyDegeneratesMain(PathOpsThreadState *data)
static bool b
struct MyStruct a[10]

◆ testSimplifyDegeneratesMain()

static void testSimplifyDegeneratesMain ( PathOpsThreadState data)
static

Definition at line 17 of file PathOpsSimplifyDegenerateThreadedTest.cpp.

17 {
18 SkASSERT(data);
20 int ax = state.fA & 0x03;
21 int ay = state.fA >> 2;
22 int bx = state.fB & 0x03;
23 int by = state.fB >> 2;
24 int cx = state.fC & 0x03;
25 int cy = state.fC >> 2;
26 for (int d = 0; d < 16; ++d) {
27 int dx = d & 0x03;
28 int dy = d >> 2;
29 for (int e = d ; e < 16; ++e) {
30 int ex = e & 0x03;
31 int ey = e >> 2;
32 for (int f = d ; f < 16; ++f) {
33 int fx = f & 0x03;
34 int fy = f >> 2;
35 if (state.fD && (ex - dx) * (fy - dy)
36 != (ey - dy) * (fx - dx)) {
37 continue;
38 }
39 SkString pathStr;
41 path.moveTo(SkIntToScalar(ax), SkIntToScalar(ay));
42 path.lineTo(SkIntToScalar(bx), SkIntToScalar(by));
43 path.lineTo(SkIntToScalar(cx), SkIntToScalar(cy));
44 path.close();
45 path.moveTo(SkIntToScalar(dx), SkIntToScalar(dy));
46 path.lineTo(SkIntToScalar(ex), SkIntToScalar(ey));
47 path.lineTo(SkIntToScalar(fx), SkIntToScalar(fy));
48 path.close();
49 if (state.fReporter->verbose()) {
50 pathStr.appendf(" path.moveTo(%d, %d);\n", ax, ay);
51 pathStr.appendf(" path.lineTo(%d, %d);\n", bx, by);
52 pathStr.appendf(" path.lineTo(%d, %d);\n", cx, cy);
53 pathStr.appendf(" path.close();\n");
54 pathStr.appendf(" path.moveTo(%d, %d);\n", dx, dy);
55 pathStr.appendf(" path.lineTo(%d, %d);\n", ex, ey);
56 pathStr.appendf(" path.lineTo(%d, %d);\n", fx, fy);
57 pathStr.appendf(" path.close();\n");
58 state.outputProgress(pathStr.c_str(), SkPathFillType::kWinding);
59 }
60 testSimplify(path, false, out, state, pathStr.c_str());
61 path.setFillType(SkPathFillType::kEvenOdd);
62 if (state.fReporter->verbose()) {
63 state.outputProgress(pathStr.c_str(), SkPathFillType::kEvenOdd);
64 }
65 testSimplify(path, true, out, state, pathStr.c_str());
66 }
67 }
68 }
69}
bool testSimplify(SkPath &path, bool useXor, SkPath &out, PathOpsThreadState &state, const char *pathStr)
#define SkASSERT(cond)
Definition SkAssert.h:116
#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
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition main.cc:19
AtkStateType state
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition SkRecords.h:208
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