Flutter Engine
The Flutter Engine
SkPathMeasure.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2008 The Android Open Source Project
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
9
11#include "include/core/SkPath.h"
16
17#include <cstddef>
18
19class SkMatrix;
20
22
23SkPathMeasure::SkPathMeasure(const SkPath& path, bool forceClosed, SkScalar resScale)
24 : fIter(path, forceClosed, resScale)
25{
26 fContour = fIter.next();
27}
28
30
31void SkPathMeasure::setPath(const SkPath* path, bool forceClosed) {
32 fIter.reset(path ? *path : SkPath(), forceClosed);
33 fContour = fIter.next();
34}
35
37 return fContour ? fContour->length() : 0;
38}
39
41 return fContour && fContour->getPosTan(distance, position, tangent);
42}
43
45 return fContour && fContour->getMatrix(distance, matrix, (SkContourMeasure::MatrixFlags)flags);
46}
47
48bool SkPathMeasure::getSegment(SkScalar startD, SkScalar stopD, SkPath* dst, bool startWithMoveTo) {
49 return fContour && fContour->getSegment(startD, stopD, dst, startWithMoveTo);
50}
51
53 return fContour && fContour->isClosed();
54}
55
57 fContour = fIter.next();
58 return !!fContour;
59}
60
61#ifdef SK_DEBUG
62void SkPathMeasure::dump() {}
63#endif
64
65/////
66
68 if (auto cntr = meas.currentMeasure()) {
69 return cntr->fSegments.size();
70 }
71 return 0;
72}
std::unique_ptr< SkLatticeIter > fIter
Definition: LatticeOp.cpp:380
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
Definition: SkYUVMath.cpp:629
bool getMatrix(SkScalar distance, SkMatrix *matrix, MatrixFlags flags=kGetPosAndTan_MatrixFlag) const
bool getSegment(SkScalar startD, SkScalar stopD, SkPath *dst, bool startWithMoveTo) const
bool getPosTan(SkScalar distance, SkPoint *position, SkVector *tangent) const
SkScalar length() const
bool isClosed() const
static size_t CountSegments(const SkPathMeasure &)
bool getMatrix(SkScalar distance, SkMatrix *matrix, MatrixFlags flags=kGetPosAndTan_MatrixFlag)
SkScalar getLength()
void setPath(const SkPath *, bool forceClosed)
const SkContourMeasure * currentMeasure() const
Definition: SkPathMeasure.h:88
bool getSegment(SkScalar startD, SkScalar stopD, SkPath *dst, bool startWithMoveTo)
bool getPosTan(SkScalar distance, SkPoint *position, SkVector *tangent)
Definition: SkPath.h:59
float SkScalar
Definition: extension.cpp:12
FlutterSemanticsFlag flags
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
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
dst
Definition: cp.py:12