Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
tests
PathOpsSimplifyQuadThreadedTest.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
*/
7
#include "
include/core/SkPath.h
"
8
#include "
include/core/SkPathTypes.h
"
9
#include "
include/core/SkScalar.h
"
10
#include "
include/core/SkString.h
"
11
#include "
include/core/SkTypes.h
"
12
#include "
include/private/base/SkTDArray.h
"
13
#include "
tests/PathOpsExtendedTest.h
"
14
#include "
tests/PathOpsThreadedCommon.h
"
15
#include "
tests/Test.h
"
16
17
static
int
quadTest
= 66;
18
19
static
void
testSimplifyQuadsMain
(
PathOpsThreadState
* data)
20
{
21
SkASSERT
(data);
22
PathOpsThreadState
&
state
= *data;
23
SkString
pathStr;
24
int
ax
=
state
.fA & 0x03;
25
int
ay =
state
.fA >> 2;
26
int
bx =
state
.fB & 0x03;
27
int
by =
state
.fB >> 2;
28
int
cx =
state
.fC & 0x03;
29
int
cy =
state
.fC >> 2;
30
int
dx =
state
.fD & 0x03;
31
int
dy =
state
.fD >> 2;
32
for
(
int
e = 0 ; e < 16; ++e) {
33
int
ex = e & 0x03;
34
int
ey = e >> 2;
35
for
(
int
f = e ; f < 16; ++f) {
36
int
fx = f & 0x03;
37
int
fy = f >> 2;
38
for
(
int
g = f ; g < 16; ++g) {
39
int
gx = g & 0x03;
40
int
gy = g >> 2;
41
for
(
int
h
= g ;
h
< 16; ++
h
) {
42
int
hx =
h
& 0x03;
43
int
hy =
h
>> 2;
44
SkPath
path, out;
45
path.moveTo(
SkIntToScalar
(
ax
),
SkIntToScalar
(ay));
46
path.quadTo(
SkIntToScalar
(bx),
SkIntToScalar
(by),
47
SkIntToScalar
(cx),
SkIntToScalar
(cy));
48
path.lineTo(
SkIntToScalar
(dx),
SkIntToScalar
(dy));
49
path.close();
50
path.moveTo(
SkIntToScalar
(ex),
SkIntToScalar
(ey));
51
path.lineTo(
SkIntToScalar
(fx),
SkIntToScalar
(fy));
52
path.quadTo(
SkIntToScalar
(gx),
SkIntToScalar
(gy),
53
SkIntToScalar
(hx),
SkIntToScalar
(hy));
54
path.close();
55
if
(
state
.fReporter->verbose()) {
56
pathStr.
printf
(
"static void testQuads%d(skiatest::Reporter* reporter,"
57
"const char* filename) {\n"
,
quadTest
);
58
pathStr.
appendf
(
" SkPath path;\n"
);
59
pathStr.
appendf
(
" path.moveTo(%d, %d);\n"
,
ax
, ay);
60
pathStr.
appendf
(
" path.quadTo(%d, %d, %d, %d);\n"
, bx, by, cx, cy);
61
pathStr.
appendf
(
" path.lineTo(%d, %d);\n"
, dx, dy);
62
pathStr.
appendf
(
" path.close();\n"
);
63
pathStr.
appendf
(
" path.moveTo(%d, %d);\n"
, ex, ey);
64
pathStr.
appendf
(
" path.lineTo(%d, %d);\n"
, fx, fy);
65
pathStr.
appendf
(
" path.quadTo(%d, %d, %d, %d);\n"
, gx, gy, hx, hy);
66
pathStr.
appendf
(
" path.close();\n"
);
67
pathStr.
appendf
(
" testSimplify(reporter, path, filename);\n"
);
68
pathStr.
appendf
(
"}\n"
);
69
state
.outputProgress(pathStr.
c_str
(),
SkPathFillType::kWinding
);
70
}
71
testSimplify
(path,
false
, out,
state
, pathStr.
c_str
());
72
path.setFillType(
SkPathFillType::kEvenOdd
);
73
if
(
state
.fReporter->verbose()) {
74
state
.outputProgress(pathStr.
c_str
(),
SkPathFillType::kEvenOdd
);
75
}
76
testSimplify
(path,
true
, out,
state
, pathStr.
c_str
());
77
}
78
}
79
}
80
}
81
}
82
83
DEF_TEST
(PathOpsSimplifyQuadsThreaded,
reporter
) {
84
initializeTests
(
reporter
,
"testQuads"
);
85
PathOpsThreadedTestRunner
testRunner(
reporter
);
86
int
a
= 0;
87
for
(;
a
< 16; ++
a
) {
88
for
(
int
b
=
a
;
b
< 16; ++
b
) {
89
for
(
int
c =
b
; c < 16; ++c) {
90
for
(
int
d
= c;
d
< 16; ++
d
) {
91
*testRunner.
fRunnables
.
append
() =
new
PathOpsThreadedRunnable
(
92
&
testSimplifyQuadsMain
,
a
,
b
, c,
d
, &testRunner);
93
}
94
if
(!
reporter
->allowExtendedTest())
goto
finish;
95
}
96
}
97
}
98
finish:
99
testRunner.
render
();
100
}
reporter
reporter
Definition
FontMgrTest.cpp:39
testSimplify
bool testSimplify(SkPath &path, bool useXor, SkPath &out, PathOpsThreadState &state, const char *pathStr)
Definition
PathOpsExtendedTest.cpp:376
initializeTests
void initializeTests(skiatest::Reporter *reporter, const char *test)
Definition
PathOpsExtendedTest.cpp:650
PathOpsExtendedTest.h
quadTest
static int quadTest
Definition
PathOpsSimplifyQuadThreadedTest.cpp:17
testSimplifyQuadsMain
static void testSimplifyQuadsMain(PathOpsThreadState *data)
Definition
PathOpsSimplifyQuadThreadedTest.cpp:19
PathOpsThreadedCommon.h
SkASSERT
#define SkASSERT(cond)
Definition
SkAssert.h:116
SkPathTypes.h
SkPathFillType::kWinding
@ kWinding
SkPathFillType::kEvenOdd
@ kEvenOdd
SkPath.h
SkScalar.h
SkIntToScalar
#define SkIntToScalar(x)
Definition
SkScalar.h:57
SkString.h
SkTDArray.h
SkTypes.h
Test.h
DEF_TEST
#define DEF_TEST(name, reporter)
Definition
Test.h:312
PathOpsThreadedRunnable
Definition
PathOpsThreadedCommon.h:55
PathOpsThreadedTestRunner
Definition
PathOpsThreadedCommon.h:42
PathOpsThreadedTestRunner::render
void render()
Definition
PathOpsThreadedCommon.cpp:19
PathOpsThreadedTestRunner::fRunnables
SkTDArray< PathOpsThreadedRunnable * > fRunnables
Definition
PathOpsThreadedCommon.h:51
SkPath
Definition
SkPath.h:59
SkString
Definition
SkString.h:118
SkString::printf
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition
SkString.cpp:534
SkString::c_str
const char * c_str() const
Definition
SkString.h:133
SkString::appendf
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
Definition
SkString.cpp:550
SkTDArray::append
T * append()
Definition
SkTDArray.h:191
d
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition
main.cc:19
b
static bool b
Definition
ffi_native_test_module.c:74
a
struct MyStruct a[10]
state
AtkStateType state
Definition
fl_accessible_node.cc:10
ax
Definition
ax_constants.h:10
h
SkScalar h
Definition
pictureshadertile.cpp:30
PathOpsThreadState
Definition
PathOpsThreadedCommon.h:27
Generated on Fri Apr 26 2024 06:17:55 for Flutter Engine by
1.9.8