5#ifndef FLUTTER_DISPLAY_LIST_GEOMETRY_DL_GEOMETRY_CONVERSIONS_H_
6#define FLUTTER_DISPLAY_LIST_GEOMETRY_DL_GEOMETRY_CONVERSIONS_H_
10#include "flutter/third_party/skia/include/core/SkM44.h"
11#include "flutter/third_party/skia/include/core/SkMatrix.h"
12#include "flutter/third_party/skia/include/core/SkRRect.h"
13#include "flutter/third_party/skia/include/core/SkRect.h"
14#include "flutter/third_party/skia/include/core/SkSize.h"
18static_assert(
sizeof(SkPoint) ==
sizeof(
DlPoint));
19static_assert(
sizeof(SkIPoint) ==
sizeof(
DlIPoint));
20static_assert(
sizeof(SkSize) ==
sizeof(
DlSize));
21static_assert(
sizeof(SkISize) ==
sizeof(
DlISize));
22static_assert(
sizeof(SkRect) ==
sizeof(
DlRect));
23static_assert(
sizeof(SkIRect) ==
sizeof(
DlIRect));
24static_assert(
sizeof(SkVector) ==
sizeof(
DlSize));
27 return *
reinterpret_cast<const DlPoint*
>(&point);
31 return *
reinterpret_cast<const DlRect*
>(&rect);
39 return *
reinterpret_cast<const DlIRect*
>(&rect);
47 return *
reinterpret_cast<const DlSize*
>(&vector);
54 .top_left = ToDlSize(rrect.radii(SkRRect::kUpperLeft_Corner)),
55 .top_right = ToDlSize(rrect.radii(SkRRect::kUpperRight_Corner)),
56 .bottom_left = ToDlSize(rrect.radii(SkRRect::kLowerLeft_Corner)),
57 .bottom_right = ToDlSize(rrect.radii(SkRRect::kLowerRight_Corner)),
64 matrix[SkMatrix::kMScaleX], matrix[SkMatrix::kMSkewY], 0.0f, matrix[SkMatrix::kMPersp0],
65 matrix[SkMatrix::kMSkewX], matrix[SkMatrix::kMScaleY], 0.0f, matrix[SkMatrix::kMPersp1],
66 0.0f, 0.0f, 1.0f, 0.0f,
67 matrix[SkMatrix::kMTransX], matrix[SkMatrix::kMTransY], 0.0f, matrix[SkMatrix::kMPersp2]
74 matrix.getColMajor(dl_matrix.
m);
79 return *
reinterpret_cast<const SkPoint*
>(&point);
83 return points ==
nullptr ? nullptr :
reinterpret_cast<const SkPoint*
>(
points);
87 return points ==
nullptr ? nullptr :
reinterpret_cast<SkPoint*
>(
points);
91 return *
reinterpret_cast<const SkRect*
>(&rect);
95 return *
reinterpret_cast<const SkIRect*
>(&rect);
99 std::optional<const DlIRect> rect) {
100 return rect.has_value() ? std::optional(
ToSkIRect(*rect)) : std::nullopt;
104 return rect ==
nullptr ? nullptr :
reinterpret_cast<const SkRect*
>(rect);
107inline const SkRect*
ToSkRect(
const std::optional<DlRect>& rect) {
108 return rect.has_value() ? &
ToSkRect(rect.value()) :
nullptr;
112 return rect ==
nullptr ? nullptr :
reinterpret_cast<SkRect*
>(rect);
116 return rects ==
nullptr ? nullptr :
reinterpret_cast<const SkRect*
>(rects);
120 return rects ==
nullptr ? nullptr :
reinterpret_cast<const SkIRect*
>(rects);
124 return *
reinterpret_cast<const SkSize*
>(&
size);
128 return *
reinterpret_cast<const SkISize*
>(&
size);
132 return *
reinterpret_cast<const SkVector*
>(&
size);
137 radii[SkRRect::kUpperLeft_Corner] =
139 radii[SkRRect::kUpperRight_Corner] =
141 radii[SkRRect::kLowerLeft_Corner] =
143 radii[SkRRect::kLowerRight_Corner] =
160 return SkMatrix::MakeAll(matrix.
m[0], matrix.
m[4], matrix.
m[12],
161 matrix.
m[1], matrix.
m[5], matrix.
m[13],
162 matrix.
m[3], matrix.
m[7], matrix.
m[15]);
166 return SkM44::ColMajor(matrix.
m);
const SkPoint & ToSkPoint(const DlPoint &point)
const DlISize & ToDlISize(const SkISize &size)
const DlPoint & ToDlPoint(const SkPoint &point)
const SkSize & ToSkSize(const DlSize &size)
impeller::ISize32 DlISize
const SkIRect & ToSkIRect(const DlIRect &rect)
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all 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
const SkRRect ToApproximateSkRRect(const DlRoundSuperellipse &rse)
const DlSize & ToDlSize(const SkVector &vector)
SkMatrix ToSkMatrix(const DlMatrix &matrix)
impeller::IRect32 DlIRect
const DlIRect & ToDlIRect(const SkIRect &rect)
impeller::IPoint32 DlIPoint
const SkPoint * ToSkPoints(const DlPoint *points)
const SkVector & ToSkVector(const DlSize &size)
const SkRect * ToSkRects(const DlRect *rects)
std::optional< const SkIRect > ToOptSkIRect(std::optional< const DlIRect > rect)
const DlRoundRect ToDlRoundRect(const SkRRect &rrect)
const SkIRect * ToSkIRects(const DlIRect *rects)
const SkRRect ToSkRRect(const DlRoundRect &round_rect)
DlMatrix ToDlMatrix(const SkMatrix &matrix)
SkM44 ToSkM44(const DlMatrix &matrix)
const DlRect & ToDlRect(const SkRect &rect)
const SkRect & ToSkRect(const DlRect &rect)
const SkISize & ToSkISize(const DlISize &size)
A 4x4 matrix using column-major storage.
static constexpr Matrix MakeColumn(Scalar m0, Scalar m1, Scalar m2, Scalar m3, Scalar m4, Scalar m5, Scalar m6, Scalar m7, Scalar m8, Scalar m9, Scalar m10, Scalar m11, Scalar m12, Scalar m13, Scalar m14, Scalar m15)
static RoundRect MakeRectRadii(const Rect &rect, const RoundingRadii &radii)
constexpr const RoundingRadii & GetRadii() const
constexpr const Rect & GetBounds() const
RoundRect ToApproximateRoundRect() const
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
std::vector< Point > points