Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
path_ops.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "path_ops.h"
6
7namespace flutter {
9 auto* path = new SkPath();
10 path->setFillType(fill_type);
11 return path;
12}
13
15 delete path;
16}
17
19 path->moveTo(x, y);
20}
21
23 path->lineTo(x, y);
24}
25
27 SkScalar x1,
28 SkScalar y1,
29 SkScalar x2,
30 SkScalar y2,
31 SkScalar x3,
32 SkScalar y3) {
33 path->cubicTo(x1, y1, x2, y2, x3, y3);
34}
35
37 path->close();
38}
39
41 path->reset();
42}
43
44void Op(SkPath* one, SkPath* two, SkPathOp op) {
45 Op(*one, *two, op, one);
46}
47
49 return static_cast<int>(path->getFillType());
50}
51
53 int point_count = path->countPoints();
54 int verb_count = path->countVerbs();
55
56 auto data = new PathData();
57 data->points = new float[point_count * 2];
58 data->point_count = point_count * 2;
59 data->verbs = new uint8_t[verb_count];
60 data->verb_count = verb_count;
61
62 path->getVerbs(data->verbs, verb_count);
63 path->getPoints(reinterpret_cast<SkPoint*>(data->points), point_count);
64 return data;
65}
66
68 delete[] data->points;
69 delete[] data->verbs;
70 delete data;
71}
72
73} // namespace flutter
SkPathOp
Definition SkPathOps.h:22
SkPathFillType
Definition SkPathTypes.h:11
float SkScalar
Definition extension.cpp:12
double y
double x
void MoveTo(SkPath *path, SkScalar x, SkScalar y)
Definition path_ops.cc:18
void Close(SkPath *path)
Definition path_ops.cc:36
void LineTo(SkPath *path, SkScalar x, SkScalar y)
Definition path_ops.cc:22
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
void CubicTo(SkPath *path, SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
Definition path_ops.cc:26
void DestroyData(PathData *data)
Definition path_ops.cc:67
void DestroyPath(SkPath *path)
Definition path_ops.cc:14
int GetFillType(SkPath *path)
Definition path_ops.cc:48
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
SkPath * CreatePath(SkPathFillType fill_type)
Definition path_ops.cc:8
struct PathData * Data(SkPath *path)
Definition path_ops.cc:52
void Reset(SkPath *path)
Definition path_ops.cc:40