36 static constexpr uint32_t kMaxChopsPerCurve = 10;
38 return 1 <<
std::min(chopCount, kMaxChopsPerCurve);
43 const SkRect& pathBounds) {
51 for (
int i = 0;
i < 4; ++
i) {
65 srcTol = devTol / stretch;
83 uint32_t pointsLeft) {
114 uint32_t pointsLeft) {
115 if (pointsLeft < 2 ||
150 double x0 = qPts[0].
fX;
151 double y0 = qPts[0].
fY;
152 double x1 = qPts[1].
fX;
153 double y1 = qPts[1].
fY;
154 double x2 = qPts[2].
fX;
155 double y2 = qPts[2].
fY;
158 double a2 = x1*y2-x2*y1;
159 double a5 = x2*y0-x0*y2;
160 double a8 = x0*y1-x1*y0;
161 double det = a2 + a5 + a8;
182 SkVector lineVec = qPts[(maxEdge + 1)%3] - qPts[maxEdge];
194 fM[5] = -lineVec.
dot(qPts[maxEdge]);
198 fM[0] = 0; fM[1] = 0; fM[2] = 100.f;
199 fM[3] = 0; fM[4] = 0; fM[5] = 100.f;
202 double scale = 1.0/det;
205 double a3, a4, a6, a7;
231 klm[0] =
p[2].fY -
p[0].fY;
232 klm[1] =
p[0].fX -
p[2].fX;
233 klm[2] =
p[2].fX *
p[0].fY -
p[0].fX *
p[2].fY;
235 klm[3] = w2 * (
p[1].fY -
p[0].fY);
236 klm[4] = w2 * (
p[0].fX -
p[1].fX);
237 klm[5] = w2 * (
p[1].fX *
p[0].fY -
p[0].fX *
p[1].fY);
239 klm[6] = w2 * (
p[2].fY -
p[1].fY);
240 klm[7] = w2 * (
p[1].fX -
p[2].fX);
241 klm[8] = w2 * (
p[2].fX *
p[1].fY -
p[1].fX *
p[2].fY);
245 for (
int i = 0;
i < 9; ++
i) {
250 for (
int i = 0;
i < 9; ++
i) {
265bool is_point_within_cubic_tangents(
const SkPoint&
a,
299void convert_noninflect_cubic_to_quads(
const SkPoint p[4],
303 bool preserveFirstTangent =
true,
304 bool preserveLastTangent =
true) {
325 static const int kMaxSubdivs = 10;
327 ab.scale(kLengthScale);
328 dc.
scale(kLengthScale);
335 if (dSqd < toleranceSqd) {
337 if (preserveFirstTangent == preserveLastTangent) {
343 newC = (c0 + c1) * 0.5f;
344 }
else if (preserveFirstTangent) {
358 convert_noninflect_cubic_to_quads(
359 choppedPts + 0, toleranceSqd, quads, sublevel + 1, preserveFirstTangent,
false);
360 convert_noninflect_cubic_to_quads(
361 choppedPts + 3, toleranceSqd, quads, sublevel + 1,
false, preserveLastTangent);
364void convert_noninflect_cubic_to_quads_with_constraint(
const SkPoint p[4],
409 if (detABSqd * invDALengthSqd < toleranceSqd &&
410 detDCSqd * invDALengthSqd < toleranceSqd) {
440 static const int kMaxSubdivs = 10;
442 ab.scale(kLengthScale);
443 dc.scale(kLengthScale);
450 if (dSqd < toleranceSqd) {
451 SkPoint cAvg = (c0 + c1) * 0.5f;
454 if (!is_point_within_cubic_tangents(
p[0],
ab, dc,
p[3],
dir, cAvg)) {
460 cAvg.
fX =
ab.fY * z1 - z0 * dc.fY;
461 cAvg.
fY = z0 * dc.fX -
ab.fX * z1;
466 if (sublevel <= kMaxSubdivs) {
474 subdivide = 2 * d0d1 + d0Sqd + d1Sqd > toleranceSqd;
487 convert_noninflect_cubic_to_quads_with_constraint(
488 choppedPts + 0, toleranceSqd,
dir, quads, sublevel + 1);
489 convert_noninflect_cubic_to_quads_with_constraint(
490 choppedPts + 3, toleranceSqd,
dir, quads, sublevel + 1);
510 convert_noninflect_cubic_to_quads(
cubic, tolSqd, quads);
531 convert_noninflect_cubic_to_quads_with_constraint(
cubic, tolSqd,
dir, quads);
static float tolerance_to_wangs_precision(float srcTol)
uint32_t max_bezier_vertices(uint32_t chopCount)
static const SkScalar kMinCurveTol
static const int points[]
static bool isFinite(const SkRect &r)
static bool SkIsFinite(T x, Pack... values)
static constexpr float sk_ieee_float_divide(float numer, float denom)
void SkChopCubicAtHalf(const SkPoint src[4], SkPoint dst[7])
int SkChopCubicAtInflections(const SkPoint src[4], SkPoint dst[10])
static SkPoint * subdivide(const SkConic &src, SkPoint pts[], int level)
#define SkScalarInvert(x)
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
#define SkScalarAve(a, b)
#define SK_ScalarNearlyZero
static SkScalar SkScalarSquare(SkScalar x)
void set(const SkPoint controlPts[3])
SkScalar mapRadius(SkScalar radius) const
SkMatrix & postConcat(const SkMatrix &other)
SkMatrix & setTranslate(SkScalar dx, SkScalar dy)
SkScalar getMaxScale() const
static SkPoint MakeOrthog(const SkPoint &vec, Side side=kLeft_Side)
static SkScalar LengthSqd(const SkPoint &pt)
static SkScalar DistanceToLineSegmentBetweenSqd(const SkPoint &pt, const SkPoint &a, const SkPoint &b)
static SkScalar DistanceToSqd(const SkPoint &pt, const SkPoint &a)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
static float max(float r, float g, float b)
static float min(float r, float g, float b)
void convertCubicToQuads(const SkPoint p[4], SkScalar tolScale, skia_private::TArray< SkPoint, true > *quads)
uint32_t generateCubicPoints(const SkPoint &p0, const SkPoint &p1, const SkPoint &p2, const SkPoint &p3, SkScalar tolSqd, SkPoint **points, uint32_t pointsLeft)
uint32_t quadraticPointCount(const SkPoint points[], SkScalar tol)
uint32_t cubicPointCount(const SkPoint points[], SkScalar tol)
SkScalar scaleToleranceToSrc(SkScalar devTol, const SkMatrix &viewM, const SkRect &pathBounds)
void convertCubicToQuadsConstrainToTangents(const SkPoint p[4], SkScalar tolScale, SkPathFirstDirection dir, skia_private::TArray< SkPoint, true > *quads)
void getConicKLM(const SkPoint p[3], const SkScalar weight, SkMatrix *klm)
static const int kMaxPointsPerCurve
uint32_t generateQuadraticPoints(const SkPoint &p0, const SkPoint &p1, const SkPoint &p2, SkScalar tolSqd, SkPoint **points, uint32_t pointsLeft)
const CatchEntryMove ab[]
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 to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
static float DotProduct(const SkVector &a, const SkVector &b)
float dot(const SkVector &vec) const
float cross(const SkVector &vec) const
void scale(float scale, SkPoint *dst) const
SkScalar fBottom
larger y-axis bounds
SkScalar fLeft
smaller x-axis bounds
SkScalar fRight
larger x-axis bounds
constexpr float height() const
constexpr float width() const
SkScalar fTop
smaller y-axis bounds