10namespace skia_conversions {
13 return Rect::MakeLTRB(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
17 if (rect ==
nullptr) {
20 return Rect::MakeLTRB(rect->fLeft, rect->fTop, rect->fRight, rect->fBottom);
24 auto result = std::vector<Rect>();
25 for (
int i = 0; i <
count; i++) {
33 for (
auto i = 0; i <
count; i++) {
61 builder.Reserve(path.countPoints() + 8, path.countVerbs() + 8);
64 verb = iterator.next(data.points);
67 builder.MoveTo(
ToPoint(data.points[0]));
70 builder.LineTo(
ToPoint(data.points[1]));
73 builder.QuadraticCurveTo(
ToPoint(data.points[1]),
77 constexpr auto kPow2 = 1;
78 constexpr auto kQuadCount = 1 + (2 * (1 << kPow2));
80 const auto curve_count =
84 iterator.conicWeight(),
89 for (
int curve_index = 0, point_index = 0;
90 curve_index < curve_count;
91 curve_index++, point_index += 2
98 builder.CubicCurveTo(
ToPoint(data.points[1]),
ToPoint(data.points[2]),
110 switch (path.getFillType()) {
126 builder.Shift(shift);
127 auto sk_bounds = path.getBounds().makeOutset(shift.
x, shift.
y);
128 builder.SetBounds(
ToRect(sk_bounds));
129 return builder.TakePath(fill_type);
158 auto result = std::vector<Matrix>();
159 for (
int i = 0; i <
count; i++) {
160 auto form = xform[i];
163 form.fSCos, form.fSSin, 0, 0,
164 -form.fSSin, form.fSCos, 0, 0,
166 form.fTx, form.fTy, 0, 1
199 std::vector<Color>& colors,
200 std::vector<float>& stops) {
203 auto* dl_colors = gradient->
colors();
204 auto* dl_stops = gradient->
stops();
205 if (dl_stops[0] != 0.0) {
207 stops.emplace_back(0);
209 for (
auto i = 0; i < gradient->
stop_count(); i++) {
211 stops.emplace_back(std::clamp(dl_stops[i], 0.0f, 1.0f));
213 if (dl_stops[gradient->
stop_count() - 1] != 1.0) {
214 colors.emplace_back(colors.back());
215 stops.emplace_back(1.0);
217 for (
auto i = 1; i < gradient->
stop_count(); i++) {
218 stops[i] = std::clamp(stops[i], stops[i - 1], stops[i]);
static const int points[]
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kBGR_101010x_XR_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
static int ConvertConicToQuads(const SkPoint &p0, const SkPoint &p1, const SkPoint &p2, SkScalar w, SkPoint pts[], int pow2)
SkVector radii(Corner corner) const
const SkRect & getBounds() const
const DlColor * colors() const
const float * stops() const
Path TakePath(FillType fill=FillType::kNonZero)
PathBuilder & SetBounds(Rect bounds)
Set the bounding box that will be used by Path.GetBoundingBox in place of performing the computation.
PathBuilder & AddRoundedRect(Rect rect, RoundingRadii radii)
PathBuilder & SetConvexity(Convexity value)
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
static SkPath GetPath(SkTextBlob *textBlob)
#define FML_DCHECK(condition)
std::optional< impeller::PixelFormat > ToPixelFormat(SkColorType type)
Path PathDataFromTextBlob(const sk_sp< SkTextBlob > &blob, Point shift)
std::vector< Point > ToPoints(const SkPoint points[], int count)
Path ToPath(const SkPath &path, Point shift)
void ConvertStops(const flutter::DlGradientColorSourceBase *gradient, std::vector< Color > &colors, std::vector< float > &stops)
Convert display list colors + stops into impeller colors and stops, taking care to ensure that the st...
Point ToPoint(const SkPoint &point)
Size ToSize(const SkPoint &point)
std::vector< Rect > ToRects(const SkRect tex[], int count)
PathBuilder::RoundingRadii ToRoundingRadii(const SkRRect &rrect)
std::vector< Matrix > ToRSXForms(const SkRSXform xform[], int count)
Rect ToRect(const SkRect &rect)
Color ToColor(const flutter::DlColor &color)
A 4x4 matrix using column-major storage.
static constexpr TPoint< Type > MakeXY(Type x, Type y)
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)