4 {
5
6
8
9
13 }
18 }
20 struct Scratch {
22 };
23
24 std::unique_ptr<Scratch[]>
s(
new Scratch[n]);
28 s[0].r = {pts[0].
x() + 2 * pts[1].
x(), pts[0].
y() + 2 * pts[1].
y()};
29 for (size_t i = 1; i < n - 1; ++i) {
33 s[i].r = {4 * pts[i].
x() + 2 * pts[i + 1].
x(), 4 * pts[i].
y() + 2 * pts[i + 1].
y()};
34 }
38 s[n - 1].r = {8 * pts[n - 1].
x() + pts[
N - 1].
x(), 8 * pts[n - 1].
y() + pts[
N - 1].
y()};
39 for (size_t i = 1; i < n; i++) {
40 float mx =
s[i].a.
x() /
s[i - 1].b.
x();
41 float my =
s[i].a.
y() /
s[i - 1].b.
y();
42 s[i].b -= {mx *
s[i - 1].c.
x(), my *
s[i - 1].c.
y()};
43 s[i].r -= {mx *
s[i - 1].r.
x(), my *
s[i - 1].r.
y()};
44 }
45 s[n - 1].p = {
s[n - 1].r.
x() /
s[n - 1].b.
x(),
s[n - 1].r.
y() /
s[n - 1].b.
y()};
46 for (
int i = (
int)
N - 3; i >= 0; --i) {
47 s[i].p = {(
s[i].r.
x() -
s[i].c.
x() *
s[i + 1].p.fX) /
s[i].
b.
x(),
48 (
s[i].r.
y() -
s[i].c.
y() *
s[i + 1].p.fY) /
s[i].
b.
y()};
49 }
50
52 for (size_t i = 0; i < n - 1; i++) {
53 SkPoint q = {2 * pts[i + 1].
x() -
s[i + 1].p.fX, 2 * pts[i + 1].
y() -
s[i + 1].p.fY};
54 path.cubicTo(
s[i].p, q, pts[i + 1]);
55 }
56 SkPoint q = {0.5f * (pts[
N - 1].
x() +
s[n - 1].p.
x()),
57 0.5f * (pts[
N - 1].
y() +
s[n - 1].p.
y())};
58 path.cubicTo(
s[n - 1].p, q, pts[n]);
60}
61
69
70
72 {62, 511}, {162, 605}, {262, 610}, {362, 402}, {462, 959},
73 {562, 58}, {662, 272}, {762, 99}, {862, 759}, {962, 945},
74 };
75
76 canvas->
drawPath(MakeCubicSplineInterpolation(pts, std::size(pts)), p);
77
81}
82}
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
void drawPath(const SkPath &path, const SkPaint &paint)
@ kPoints_PointMode
draw each point separately
@ kStroke_Style
set to stroke geometry
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
constexpr float y() const
constexpr float x() const