14 case SkPathFillType::kEvenOdd:
16 case SkPathFillType::kWinding:
18 case SkPathFillType::kInverseEvenOdd:
19 case SkPathFillType::kInverseWinding:
27 return SkPathFillType::kEvenOdd;
29 return SkPathFillType::kWinding;
47 return DlPath(SkPath().addRect(left, top, right, bottom));
65 return DlPath(SkPath::Oval(SkRect::MakeLTRB(left, top, right, bottom)));
69 return DlPath(SkPath::Circle(center.x, center.y, radius));
79 bool counter_clock_wise) {
80 return DlPath(SkPath::RRect(
82 counter_clock_wise ? SkPathDirection::kCCW : SkPathDirection::kCW));
98 ToSkFillType(fill_type)));
117 return data_->sk_path;
121 const SkPath&
path = data_->sk_path;
122 if (
path.isEmpty()) {
126 auto iterator = SkPath::Iter(
path,
false);
136 auto verb = SkPath::Verb::kDone_Verb;
138 verb = iterator.next(
data.points);
140 case SkPath::kMove_Verb:
143 case SkPath::kLine_Verb:
146 case SkPath::kQuad_Verb:
149 case SkPath::kConic_Verb:
152 iterator.conicWeight())) {
153 ReduceConic(receiver,
157 iterator.conicWeight());
160 case SkPath::kCubic_Verb:
165 case SkPath::kClose_Verb:
168 case SkPath::kDone_Verb:
171 }
while (verb != SkPath::Verb::kDone_Verb);
175 uint32_t count = data_->render_count;
178 data_->sk_path.setIsVolatile(
false);
180 data_->render_count = ++count;
191 SkPath
path = data_->sk_path;
197 SkPathFillType sk_type = ToSkFillType(
type);
198 if (data_->sk_path.getFillType() == sk_type) {
201 SkPath
path = data_->sk_path;
202 path.setFillType(sk_type);
219 SkPoint sk_points[2];
230 bool ret =
GetSkPath().isRRect(rrect ? &sk_rrect :
nullptr);
242 return ToDlFillType(
GetSkPath().getFillType());
258 return data_->sk_path.isConvex();
278 FML_DCHECK(std::isfinite(weight) && weight > 0);
281 const DlScalar scale = 1.0f / (1.0f + weight);
289 DlPoint tcp = cp * (weight * scale);
298 DlPoint sub_mid = (tp1 + tcp + tcp + tp2) * 0.5f;
304 receiver.
QuadTo(sub_cp1, sub_mid);
305 receiver.
QuadTo(sub_cp2, p2);
315 }
else if (cp != p2) {
DlPathBuilder & AddRoundSuperellipse(const DlRoundSuperellipse &rse)
Append a closed rounded super-ellipse contour to the path.
const DlPath TakePath()
Returns the path constructed by this path builder and resets its internal state to the default state ...
bool Contains(const DlPoint point) const
bool IsRect(DlRect *rect=nullptr, bool *is_closed=nullptr) const
static constexpr uint32_t kMaxVolatileUses
bool operator==(const DlPath &other) const
static DlPath MakeRectLTRB(DlScalar left, DlScalar top, DlScalar right, DlScalar bottom)
static DlPath MakeLine(const DlPoint a, const DlPoint b)
DlPath WithOffset(const DlPoint offset) const
DlPath operator+(const DlPath &other) const
static DlPath MakeRoundRect(const DlRoundRect &rrect)
static DlPath MakeCircle(const DlPoint center, DlScalar radius)
static DlPath MakeArc(const DlRect &bounds, DlDegrees start, DlDegrees sweep, bool use_center)
static DlPath MakeRectXYWH(DlScalar x, DlScalar y, DlScalar width, DlScalar height)
static DlPath MakeRect(const DlRect &rect)
static DlPath MakeRoundSuperellipse(const DlRoundSuperellipse &rse)
static DlPath MakeRoundRectXY(const DlRect &rect, DlScalar x_radius, DlScalar y_radius, bool counter_clock_wise=false)
bool IsRoundRect(DlRoundRect *rrect=nullptr) const
static DlPath MakeOvalLTRB(DlScalar left, DlScalar top, DlScalar right, DlScalar bottom)
DlRect GetBounds() const override
const SkPath & GetSkPath() const
DlPathFillType GetFillType() const override
DlPath WithFillType(DlPathFillType type) const
bool IsLine(DlPoint *start=nullptr, DlPoint *end=nullptr) const
void WillRenderSkPath() const
static DlPath MakeOval(const DlRect &bounds)
void Dispatch(DlPathReceiver &receiver) const override
bool IsConvex() const override
bool IsOval(DlRect *bounds=nullptr) const
static DlPath MakePoly(const DlPoint pts[], int count, bool close, DlPathFillType fill_type=DlPathFillType::kNonZero)
Collection of functions to receive path segments from the underlying path representation via the DlPa...
virtual void CubicTo(const Point &cp1, const Point &cp2, const Point &p2)=0
virtual void LineTo(const Point &p2)=0
virtual void QuadTo(const Point &cp, const Point &p2)=0
virtual void MoveTo(const Point &p2, bool will_be_closed)=0
virtual bool ConicTo(const Point &cp, const Point &p2, Scalar weight)
#define FML_UNREACHABLE()
#define FML_DCHECK(condition)
impeller::Scalar DlScalar
const SkPoint & ToSkPoint(const DlPoint &point)
const DlPoint & ToDlPoint(const SkPoint &point)
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
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
const SkPoint * ToSkPoints(const DlPoint *points)
const DlRoundRect ToDlRoundRect(const SkRRect &rrect)
const SkRRect ToSkRRect(const DlRoundRect &round_rect)
const DlRect & ToDlRect(const SkRect &rect)
const SkRect & ToSkRect(const DlRect &rect)
constexpr bool IsZero() const
constexpr Point GetCenter() const
Get the center point as a |Point|.
std::vector< Point > points