Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
skottie::ShapeValue Class Referencefinal

#include <SkottieValue.h>

Inheritance diagram for skottie::ShapeValue:

Public Member Functions

 operator SkPath () const
 

Detailed Description

Definition at line 49 of file SkottieValue.h.

Member Function Documentation

◆ operator SkPath()

skottie::ShapeValue::operator SkPath ( ) const

Definition at line 128 of file ShapeKeyframeAnimator.cpp.

128 {
129 const auto vertex_count = this->size() / kFloatsPerVertex;
130
132
133 if (vertex_count) {
134 // conservatively assume all cubics
135 path.incReserve(1 + SkToInt(vertex_count * 3));
136
137 // Move to first vertex.
138 path.moveTo((*this)[kX_Index], (*this)[kY_Index]);
139 }
140
141 auto addCubic = [&](size_t from_vertex, size_t to_vertex) {
142 const auto from_index = kFloatsPerVertex * from_vertex,
143 to_index = kFloatsPerVertex * to_vertex;
144
145 const SkPoint p0 = SkPoint{ (*this)[from_index + kX_Index],
146 (*this)[from_index + kY_Index] },
147 p1 = SkPoint{ (*this)[ to_index + kX_Index],
148 (*this)[ to_index + kY_Index] },
149 c0 = SkPoint{ (*this)[from_index + kOutX_Index],
150 (*this)[from_index + kOutY_Index] } + p0,
151 c1 = SkPoint{ (*this)[ to_index + kInX_Index],
152 (*this)[ to_index + kInY_Index] } + p1;
153
154 if (c0 == p0 && c1 == p1) {
155 // If the control points are coincident, we can power-reduce to a straight line.
156 // TODO: we could also do that when the controls are on the same line as the
157 // vertices, but it's unclear how common that case is.
158 path.lineTo(p1);
159 } else {
160 path.cubicTo(c0, c1, p1);
161 }
162 };
163
164 for (size_t i = 1; i < vertex_count; ++i) {
165 addCubic(i - 1, i);
166 }
167
168 // Close the path with an extra cubic, if needed.
169 if (vertex_count && this->back() != 0) {
170 addCubic(vertex_count - 1, 0);
171 path.close();
172 }
173
174 return path.detach();
175}
constexpr int SkToInt(S x)
Definition SkTo.h:29
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
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259

The documentation for this class was generated from the following files: