13 : arc_(arc), stroke_width_(-1.0f), cap_(
Cap::
kButt) {}
16 : arc_(arc), stroke_width_(stroke.
width), cap_(stroke.cap) {
25 if (stroke_width_ < 0) {
36 if (stroke_width_ < 0) {
59std::optional<Rect> ArcGeometry::GetCoverage(
const Matrix&
transform)
const {
88bool ArcGeometry::CapsOverlap()
const {
109 auto half_width = stroke_width_ * 0.5f;
110 auto inner_radius = radius - half_width;
111 auto inner_arc_end_x =
112 cos(Radians(arc_.
GetSweep()).radians) * inner_radius;
113 auto inner_square_cap_end_x =
115 cos(Radians(arc_.
GetSweep() + Degrees(90)).radians) * half_width;
116 return inner_square_cap_end_x > inner_radius;
126 auto start_point =
Point(radius, 0);
127 auto sweep_radians = Radians(arc_.
GetSweep()).radians;
128 auto end_point =
Point(cos(sweep_radians), sin(sweep_radians)) * radius;
130 stroke_width_ * stroke_width_;
bool IsAxisAlignedRect() const override
Scalar ComputeAlphaCoverage(const Matrix &transform) const override
bool CoversArea(const Matrix &transform, const Rect &rect) const override
Determines if this geometry, transformed by the given transform, will completely cover all surface ar...
ArcGeometry(const Arc &arc)
virtual bool SupportsTriangleFan() const =0
Whether the primitive type TriangleFan is supported by the backend.
const Capabilities & GetDeviceCapabilities() const
Tessellator & GetTessellator() const
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
static Scalar ComputeStrokeAlphaCoverage(const Matrix &entity, Scalar stroke_width)
Compute an alpha value to simulate lower coverage of fractional pixel strokes.
static GeometryResult ComputePositionGeometry(const ContentContext &renderer, const Tessellator::VertexGenerator &generator, const Entity &entity, RenderPass &pass)
static Scalar ComputePixelHalfWidth(const Matrix &transform, Scalar width)
Render passes encode render commands directed as one specific render target into an underlying comman...
ArcVertexGenerator StrokedArc(const Matrix &view_transform, const Arc &arc, Cap cap, Scalar half_width)
Create a |VertexGenerator| that can produce vertices for a stroked arc inscribed within the given ova...
ArcVertexGenerator FilledArc(const Matrix &view_transform, const Arc &arc, bool supports_triangle_fans)
Create a |VertexGenerator| that can produce vertices for a stroked arc inscribed within the given ova...
#define FML_UNREACHABLE()
#define FML_DCHECK(condition)
Vector2 padding
The halo padding in source space.
Cap
An enum that describes ways to decorate the end of a path contour.
Rect GetTightArcBounds() const
constexpr bool IncludeCenter() const
constexpr bool IsFullCircle() const
const Size GetOvalSize() const
Returns the size of the oval bounds.
constexpr bool IsPerfectCircle() const
constexpr Degrees GetSweep() const
const Rect & GetOvalBounds() const
Return the bounds of the oval in which this arc is inscribed.
A 4x4 matrix using column-major storage.
A structure to store all of the parameters related to stroking a path or basic geometry object.
constexpr Type GetDistanceSquared(const TPoint &p) const
constexpr TRect TransformAndClipBounds(const Matrix &transform) const
Creates a new bounding box that contains this transformed rectangle, clipped against the near clippin...
constexpr TRect< T > Expand(T left, T top, T right, T bottom) const
Returns a rectangle with expanded edges. Negative expansion results in shrinking.