Flutter Engine
 
Loading...
Searching...
No Matches
path_source.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
7namespace impeller {
8
10
12 return true;
13}
14
18
20 return rect_;
21}
22
24 receiver.MoveTo(rect_.GetLeftTop(), true);
25 receiver.LineTo(rect_.GetRightTop());
26 receiver.LineTo(rect_.GetRightBottom());
27 receiver.LineTo(rect_.GetLeftBottom());
28 receiver.LineTo(rect_.GetLeftTop());
29 receiver.Close();
30}
31
32EllipsePathSource::EllipsePathSource(const Rect& bounds) : bounds_(bounds) {}
33
35
39
41 return bounds_;
42}
43
45 return true;
46}
47
49 Scalar left = bounds_.GetLeft();
50 Scalar right = bounds_.GetRight();
51 Scalar top = bounds_.GetTop();
52 Scalar bottom = bounds_.GetBottom();
53 Point center = bounds_.GetCenter();
54
55 receiver.MoveTo(Point(left, center.y), true);
56 receiver.ConicTo(Point(left, top), Point(center.x, top), kSqrt2Over2);
57 receiver.ConicTo(Point(right, top), Point(right, center.y), kSqrt2Over2);
58 receiver.ConicTo(Point(right, bottom), Point(center.x, bottom), kSqrt2Over2);
59 receiver.ConicTo(Point(left, bottom), Point(left, center.y), kSqrt2Over2);
60
61 receiver.Close();
62}
63
64} // namespace impeller
EllipsePathSource(const Rect &bounds)
void Dispatch(PathReceiver &receiver) const override
bool IsConvex() const override
Rect GetBounds() const override
FillType GetFillType() const override
Collection of functions to receive path segments from the underlying path representation via the DlPa...
Definition path_source.h:42
virtual void LineTo(const Point &p2)=0
virtual void Close()=0
virtual void MoveTo(const Point &p2, bool will_be_closed)=0
virtual bool ConicTo(const Point &cp, const Point &p2, Scalar weight)
Definition path_source.h:48
FillType GetFillType() const override
bool IsConvex() const override
Rect GetBounds() const override
void Dispatch(PathReceiver &receiver) const override
float Scalar
Definition scalar.h:19
constexpr float kSqrt2Over2
Definition constants.h:51
TPoint< Scalar > Point
Definition point.h:327
constexpr auto GetBottom() const
Definition rect.h:357
constexpr auto GetTop() const
Definition rect.h:353
constexpr auto GetLeft() const
Definition rect.h:351
constexpr TPoint< T > GetLeftTop() const
Definition rect.h:359
constexpr auto GetRight() const
Definition rect.h:355
constexpr TPoint< T > GetRightBottom() const
Definition rect.h:371
constexpr TPoint< T > GetLeftBottom() const
Definition rect.h:367
constexpr TPoint< T > GetRightTop() const
Definition rect.h:363
constexpr Point GetCenter() const
Get the center point as a |Point|.
Definition rect.h:382