Flutter Engine
The Flutter Engine
contour_measure.cpp
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 "export.h"
6#include "helpers.h"
7
10
11using namespace Skwasm;
12
14contourMeasureIter_create(SkPath* path, bool forceClosed, SkScalar resScale) {
15 return new SkContourMeasureIter(*path, forceClosed, resScale);
16}
17
20 auto next = iter->next();
21 if (next) {
22 next->ref();
23 }
24 return next.get();
25}
26
28 delete iter;
29}
30
32 measure->unref();
33}
34
36 return measure->length();
37}
38
40 return measure->isClosed();
41}
42
45 SkPoint* outPosition,
46 SkVector* outTangent) {
47 return measure->getPosTan(distance, outPosition, outTangent);
48}
49
51 SkScalar startD,
52 SkScalar stopD,
53 bool startWithMoveTo) {
54 SkPath* outPath = new SkPath();
55 if (!measure->getSegment(startD, stopD, outPath, startWithMoveTo)) {
56 delete outPath;
57 return nullptr;
58 }
59 return outPath;
60}
static float next(float f)
sk_sp< SkContourMeasure > next()
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
Definition: SkPath.h:59
void unref() const
Definition: SkRefCnt.h:72
SKWASM_EXPORT void contourMeasureIter_dispose(SkContourMeasureIter *iter)
SKWASM_EXPORT SkContourMeasure * contourMeasureIter_next(SkContourMeasureIter *iter)
SKWASM_EXPORT bool contourMeasure_isClosed(SkContourMeasure *measure)
SKWASM_EXPORT SkPath * contourMeasure_getSegment(SkContourMeasure *measure, SkScalar startD, SkScalar stopD, bool startWithMoveTo)
SKWASM_EXPORT SkContourMeasureIter * contourMeasureIter_create(SkPath *path, bool forceClosed, SkScalar resScale)
SKWASM_EXPORT SkScalar contourMeasure_length(SkContourMeasure *measure)
SKWASM_EXPORT void contourMeasure_dispose(SkContourMeasure *measure)
SKWASM_EXPORT bool contourMeasure_getPosTan(SkContourMeasure *measure, SkScalar distance, SkPoint *outPosition, SkVector *outTangent)
float SkScalar
Definition: extension.cpp:12
Definition: helpers.h:12
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
#define SKWASM_EXPORT
Definition: export.h:10