21#include <initializer_list>
38 b.moveTo(10, 10).lineTo(20, 20).quadTo(30, 10, 10, 20);
68 for (
const SkPath&
path : {
b.snapshot(),
b.detach() }) {
76 std::vector<SkPoint> iter_pts;
81 iter_pts.push_back(
p[0]);
84 iter_pts.push_back(
p[1]);
88 iter_pts.push_back(
p[1]);
89 iter_pts.push_back(
p[2]);
92 iter_pts.push_back(
p[1]);
93 iter_pts.push_back(
p[2]);
94 iter_pts.push_back(
p[3]);
100 if (iter_pts.size() !=
count) {
103 for (
size_t i = 0;
i <
count; ++
i) {
104 if (iter_pts[
i] != expected[
i]) {
114 b.lineTo(10, 10).lineTo(20, 30);
116 {0, 0}, {10, 10}, {20, 30},
120 b.reset().moveTo(20, 20).lineTo(10, 10).lineTo(20, 30).close().lineTo(60, 60);
122 {20, 20}, {10, 10}, {20, 30},
129 const SkRect r = { 10, 20, 30, 40 };
131 for (
int i = 0;
i < 4; ++
i) {
134 b.addRect(r,
dir,
i);
135 auto bp =
b.detach();
146 p.addRect(r,
dir,
i);
159 bool is_a =
a.isOval(&ra);
160 bool is_b =
b.isOval(&rb);
164 if (is_a && (ra != rb)) {
171 bool is_a =
a.isRRect(&rra);
172 bool is_b =
b.isRRect(&rrb);
176 if (is_a && (rra != rrb)) {
195 const SkRect r = { 10, 20, 30, 40 };
199 for (
int i = 0;
i < 4; ++
i) {
202 p.addOval(r,
dir,
i);
222 for (
int i = 0;
i < 4; ++
i) {
224 b.addRRect(rr,
dir,
i);
225 auto bp =
b.detach();
228 p.addRRect(rr,
dir,
i);
246 constexpr int N = 100;
254 for (
int i = 1;
i <
N; ++
i) {
260 auto p0 =
b.detach();
261 auto p1 =
SkPath::Make(pts,
N, vbs,
N,
nullptr, 0, p0.getFillType());
278 SkPoint pts[] = {{1, 2}, {3, 4}, {5, 6}, {7, 8}};
280 auto addpoly = [](
const SkPoint pts[],
int count,
bool isClosed) {
294 for (
bool isClosed : {
false,
true}) {
297 auto path1 = addpoly(pts,
i, isClosed);
307 .
quadTo(200, 100, 100, 200)
310 .
cubicTo(210, 200, 210, 300, 200, 300)
311 .
conicTo(150, 250, 100, 200, 1.4f);
323 {0, 1}, {2, 3}, {4, 5},
327 for (
int ctrCount = 1; ctrCount < 4; ++ctrCount) {
328 const int lastMoveToIndex = (ctrCount - 1) *
N;
330 for (
bool isClosed : {
false,
true}) {
334 for (
int i = 0;
i < ctrCount; ++
i) {
335 builder.addPolygon(pts,
N, isClosed);
336 b.addPoly(pts,
N, isClosed);
341 const int expected = isClosed ? ~lastMoveToIndex : lastMoveToIndex;
353 auto [v, pts,
w] = *(*iter)++;
362 auto [v, pts,
w] = *(*iter)++;
414 test(
"first point equals previous point", {0, 0}, {1, 2}, 1, {0, 0});
415 test(
"two points equal", {5, 7}, {5, 7}, 1, {5, 7});
416 test(
"radius is zero", {-3, 5}, {-7, 11}, 0, {-3, 5});
417 test(
"second point equals previous point", {5, 4}, {0, 0}, 1, {5, 4});
static void is_empty(skiatest::Reporter *reporter, const SkPath &p)
DEF_TEST(pathbuilder, reporter)
static bool is_eq(const SkPath &a, const SkPath &b)
static void assertIsMoveTo(skiatest::Reporter *reporter, SkPathPriv::RangeIter *iter, SkScalar x0, SkScalar y0)
static bool check_points(const SkPath &path, const SkPoint expected[], size_t count)
static void assertIsDone(skiatest::Reporter *reporter, SkPathPriv::RangeIter *iter, SkPath *p)
static void assertIsLineTo(skiatest::Reporter *reporter, SkPathPriv::RangeIter *iter, SkScalar x1, SkScalar y1)
@ kClose
SkPath::RawIter returns 0 points.
@ kCubic
SkPath::RawIter returns 4 points.
@ kConic
SkPath::RawIter returns 3 points + 1 weight.
@ kQuad
SkPath::RawIter returns 3 points.
@ kMove
SkPath::RawIter returns 1 point.
@ kLine
SkPath::RawIter returns 2 points.
#define REPORTER_ASSERT(r, cond,...)
SkPathBuilder & arcTo(const SkRect &oval, SkScalar startAngleDeg, SkScalar sweepAngleDeg, bool forceMoveTo)
SkPathBuilder & lineTo(SkPoint pt)
SkPathBuilder & addRRect(const SkRRect &, SkPathDirection, unsigned startIndex)
SkPathBuilder & moveTo(SkPoint pt)
SkPathBuilder & addOval(const SkRect &, SkPathDirection, unsigned startIndex)
SkPathBuilder & addPolygon(const SkPoint pts[], int count, bool isClosed)
static int LastMoveToIndex(const SkPath &path)
static bool HasComputedBounds(const SkPath &path)
static SkPathConvexity GetConvexityOrUnknown(const SkPath &path)
SkPath::RangeIter RangeIter
SkPath & moveTo(SkScalar x, SkScalar y)
SkPath & lineTo(SkScalar x, SkScalar y)
static SkPath Make(const SkPoint[], int pointCount, const uint8_t[], int verbCount, const SkScalar[], int conicWeightCount, SkPathFillType, bool isVolatile=false)
SkPath & quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
const SkRect & getBounds() const
SkPath & cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
SkPath & conicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w)
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
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
DEF_SWITCHES_START aot vmservice shared library name
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 to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
SkPath::RangeIter begin()
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)