Flutter Engine
The Flutter Engine
PathOpsSimplifyTrianglesThreadedTest.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2012 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 */
15#include "tests/Test.h"
16
20 state.fKey = "?";
21 int ax = state.fA & 0x03;
22 int ay = state.fA >> 2;
23 int bx = state.fB & 0x03;
24 int by = state.fB >> 2;
25 int cx = state.fC & 0x03;
26 int cy = state.fC >> 2;
27 for (int d = 0; d < 15; ++d) {
28 int dx = d & 0x03;
29 int dy = d >> 2;
30 for (int e = d + 1; e < 16; ++e) {
31 int ex = e & 0x03;
32 int ey = e >> 2;
33 for (int f = d + 1; f < 16; ++f) {
34 if (e == f) {
35 continue;
36 }
37 int fx = f & 0x03;
38 int fy = f >> 2;
39 if ((ex - dx) * (fy - dy) == (ey - dy) * (fx - dx)) {
40 continue;
41 }
42 SkString pathStr;
44 path.moveTo(SkIntToScalar(ax), SkIntToScalar(ay));
45 path.lineTo(SkIntToScalar(bx), SkIntToScalar(by));
46 path.lineTo(SkIntToScalar(cx), SkIntToScalar(cy));
47 path.close();
48 path.moveTo(SkIntToScalar(dx), SkIntToScalar(dy));
49 path.lineTo(SkIntToScalar(ex), SkIntToScalar(ey));
50 path.lineTo(SkIntToScalar(fx), SkIntToScalar(fy));
51 path.close();
52 if (state.fReporter->verbose()) {
53 pathStr.appendf(" path.moveTo(%d, %d);\n", ax, ay);
54 pathStr.appendf(" path.lineTo(%d, %d);\n", bx, by);
55 pathStr.appendf(" path.lineTo(%d, %d);\n", cx, cy);
56 pathStr.appendf(" path.close();\n");
57 pathStr.appendf(" path.moveTo(%d, %d);\n", dx, dy);
58 pathStr.appendf(" path.lineTo(%d, %d);\n", ex, ey);
59 pathStr.appendf(" path.lineTo(%d, %d);\n", fx, fy);
60 pathStr.appendf(" path.close();\n");
61 state.outputProgress(pathStr.c_str(), SkPathFillType::kWinding);
62 }
63 testSimplify(path, false, out, state, pathStr.c_str());
64 path.setFillType(SkPathFillType::kEvenOdd);
65 if (state.fReporter->verbose()) {
66 state.outputProgress(pathStr.c_str(), SkPathFillType::kEvenOdd);
67 }
68 testSimplify(path, true, out, state, pathStr.c_str());
69 }
70 }
71 }
72}
73
74DEF_TEST(PathOpsSimplifyTrianglesThreaded, reporter) {
75 initializeTests(reporter, "testTriangles");
77 for (int a = 0; a < 15; ++a) {
78 int ax = a & 0x03;
79 int ay = a >> 2;
80 for (int b = a + 1; b < 16; ++b) {
81 int bx = b & 0x03;
82 int by = b >> 2;
83 for (int c = a + 1; c < 16; ++c) {
84 if (b == c) {
85 continue;
86 }
87 int cx = c & 0x03;
88 int cy = c >> 2;
89 if ((bx - ax) * (cy - ay) == (by - ay) * (cx - ax)) {
90 continue;
91 }
92 *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
93 &testSimplifyTrianglesMain, a, b, c, 0, &testRunner);
94 }
95 if (!reporter->allowExtendedTest()) goto finish;
96 }
97 }
98finish:
99 testRunner.render();
100}
reporter
Definition: FontMgrTest.cpp:39
bool testSimplify(SkPath &path, bool useXor, SkPath &out, PathOpsThreadState &state, const char *pathStr)
void initializeTests(skiatest::Reporter *reporter, const char *test)
static void testSimplifyTrianglesMain(PathOpsThreadState *data)
DEF_TEST(PathOpsSimplifyTrianglesThreaded, reporter)
#define SkASSERT(cond)
Definition: SkAssert.h:116
#define SkIntToScalar(x)
Definition: SkScalar.h:57
SkTDArray< PathOpsThreadedRunnable * > fRunnables
Definition: SkPath.h:59
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
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
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63