5#include "flutter/lib/ui/painting/path.h"
9#include "flutter/lib/ui/floating_point.h"
10#include "flutter/lib/ui/painting/matrix.h"
11#include "flutter/lib/ui/ui_dart_state.h"
21typedef CanvasPath
Path;
25CanvasPath::CanvasPath()
26 : path_tracker_(
UIDartState::Current()->GetVolatilePathTracker()),
32CanvasPath::~CanvasPath() =
default;
34void CanvasPath::resetVolatility() {
35 if (!tracked_path_->tracking_volatility) {
36 mutable_path().setIsVolatile(
true);
37 tracked_path_->frame_count = 0;
38 tracked_path_->tracking_volatility =
true;
39 path_tracker_->Track(tracked_path_);
43int CanvasPath::getFillType() {
44 return static_cast<int>(
path().getFillType());
47void CanvasPath::setFillType(
int fill_type) {
48 mutable_path().setFillType(
static_cast<SkPathFillType>(fill_type));
52void CanvasPath::moveTo(
double x,
double y) {
57void CanvasPath::relativeMoveTo(
double x,
double y) {
62void CanvasPath::lineTo(
double x,
double y) {
67void CanvasPath::relativeLineTo(
double x,
double y) {
72void CanvasPath::quadraticBezierTo(
double x1,
double y1,
double x2,
double y2) {
78void CanvasPath::relativeQuadraticBezierTo(
double x1,
87void CanvasPath::cubicTo(
double x1,
98void CanvasPath::relativeCubicTo(
double x1,
109void CanvasPath::conicTo(
double x1,
double y1,
double x2,
double y2,
double w) {
115void CanvasPath::relativeConicTo(
double x1,
125void CanvasPath::arcTo(
double left,
132 mutable_path().arcTo(
140void CanvasPath::arcToPoint(
double arcEndX,
144 double xAxisRotation,
146 bool isClockwiseDirection) {
147 const auto arcSize = isLargeArc ? SkPath::ArcSize::kLarge_ArcSize
148 : SkPath::ArcSize::kSmall_ArcSize;
149 const auto direction =
153 SafeNarrow(xAxisRotation), arcSize, direction,
158void CanvasPath::relativeArcToPoint(
double arcEndDeltaX,
162 double xAxisRotation,
164 bool isClockwiseDirection) {
165 const auto arcSize = isLargeArc ? SkPath::ArcSize::kLarge_ArcSize
166 : SkPath::ArcSize::kSmall_ArcSize;
167 const auto direction =
170 SafeNarrow(xAxisRotation), arcSize, direction,
175void CanvasPath::addRect(
double left,
double top,
double right,
double bottom) {
182void CanvasPath::addOval(
double left,
double top,
double right,
double bottom) {
189void CanvasPath::addArc(
double left,
195 mutable_path().addArc(
203void CanvasPath::addPolygon(
const tonic::Float32List&
points,
bool close) {
204 mutable_path().addPoly(
reinterpret_cast<const SkPoint*
>(
points.data()),
205 points.num_elements() / 2, close);
210 mutable_path().addRRect(
rrect.sk_rrect);
228 tonic::Float64List matrix4(matrix4_handle);
233 ToDart(
"Path.addPathWithMatrix called with non-genuine Path."));
248 ToDart(
"Path.extendWithPath called with non-genuine Path."));
260 tonic::Float64List matrix4(matrix4_handle);
265 ToDart(
"Path.addPathWithMatrix called with non-genuine Path."));
277void CanvasPath::close() {
278 mutable_path().close();
283 mutable_path().reset();
293 auto& other_mutable_path =
path->mutable_path();
300 tonic::Float64List matrix4(matrix4_handle);
304 auto& other_mutable_path =
path->mutable_path();
305 mutable_path().transform(
sk_matrix, &other_mutable_path);
308tonic::Float32List CanvasPath::getBounds() {
329 path->mutable_path() = this->
path();
static const int points[]
static sk_sp< Effect > Create()
static void operation(T operation, uint32_t &a, uint32_t b, uint32_t c, uint32_t d, uint32_t x, uint8_t s, uint32_t t)
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
struct _Dart_Handle * Dart_Handle
DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception)
@ Dart_TypedData_kFloat32
DART_EXPORT Dart_Handle Dart_NewTypedData(Dart_TypedData_Type type, intptr_t length)
#define FML_DCHECK(condition)
unsigned useCenter Optional< SkMatrix > matrix
Optional< SkRect > bounds
sk_sp< SkBlender > blender SkRect rect
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
IMPLEMENT_WRAPPERTYPEINFO(flutter_gpu, FlutterGpuTestClass)
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
static float SafeNarrow(double value)
constexpr SkMatrix ToSkMatrix(const DlMatrix &matrix)
constexpr bool contains(std::string_view str, std::string_view needle)
Dart_Handle ToDart(const T &object)
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)