Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
impeller::RoundSuperellipseParam Struct Reference

#include <round_superellipse_param.h>

Classes

struct  Octant
 
struct  Quadrant
 

Public Member Functions

bool Contains (const Point &point) const
 
void Dispatch (PathReceiver &receiver) const
 

Static Public Member Functions

static RoundSuperellipseParam MakeBoundsRadii (const Rect &bounds, const RoundingRadii &radii)
 
static RoundSuperellipseParam MakeBoundsRadius (const Rect &bounds, Scalar radius)
 

Public Attributes

Quadrant top_right
 
Quadrant bottom_right
 
Quadrant bottom_left
 
Quadrant top_left
 
bool all_corners_same
 

Static Public Attributes

static constexpr Scalar kGapFactor = 0.29289321881f
 

Detailed Description

Definition at line 18 of file round_superellipse_param.h.

Member Function Documentation

◆ Contains()

bool impeller::RoundSuperellipseParam::Contains ( const Point point) const

Definition at line 639 of file round_superellipse_param.cc.

639 {
640 if (all_corners_same) {
641 return CornerContains(top_right, point, /*check_quadrant=*/false);
642 }
643 return CornerContains(top_right, point) &&
646}
static bool CornerContains(const Point &p, const Point &corner, const Point &direction, const Size &radii)
Definition round_rect.cc:30

References all_corners_same, bottom_left, bottom_right, impeller::CornerContains(), top_left, and top_right.

Referenced by flutter::RSuperellipse::contains().

◆ Dispatch()

void impeller::RoundSuperellipseParam::Dispatch ( PathReceiver receiver) const

Definition at line 615 of file round_superellipse_param.cc.

615 {
616 RoundSuperellipseBuilder builder(path_receiver);
617
621 path_receiver.MoveTo(start, true);
622
623 if (all_corners_same) {
624 builder.AddQuadrant(top_right, /*reverse=*/false, Point(1, 1));
625 builder.AddQuadrant(top_right, /*reverse=*/true, Point(1, -1));
626 builder.AddQuadrant(top_right, /*reverse=*/false, Point(-1, -1));
627 builder.AddQuadrant(top_right, /*reverse=*/true, Point(-1, 1));
628 } else {
629 builder.AddQuadrant(top_right, /*reverse=*/false);
630 builder.AddQuadrant(bottom_right, /*reverse=*/true);
631 builder.AddQuadrant(bottom_left, /*reverse=*/false);
632 builder.AddQuadrant(top_left, /*reverse=*/true);
633 }
634
635 path_receiver.LineTo(start);
636 path_receiver.Close();
637}
TPoint< Scalar > Point
Definition point.h:426
const size_t start

References all_corners_same, bottom_left, bottom_right, impeller::PathReceiver::Close(), impeller::PathReceiver::LineTo(), impeller::PathReceiver::MoveTo(), impeller::RoundSuperellipseParam::Octant::offset, impeller::RoundSuperellipseParam::Quadrant::offset, impeller::RoundSuperellipseParam::Octant::se_a, impeller::RoundSuperellipseParam::Quadrant::signed_scale, start, impeller::RoundSuperellipseParam::Quadrant::top, top_left, and top_right.

Referenced by flutter::DlPathBuilder::AddRoundSuperellipse().

◆ MakeBoundsRadii()

RoundSuperellipseParam impeller::RoundSuperellipseParam::MakeBoundsRadii ( const Rect bounds,
const RoundingRadii radii 
)
static

Definition at line 576 of file round_superellipse_param.cc.

578 {
579 if (radii.AreAllCornersSame() && !radii.top_left.IsEmpty()) {
580 // Having four empty corners indicate a rectangle, which needs special
581 // treatment on border containment and therefore is not `all_corners_same`.
582 return RoundSuperellipseParam{
583 .top_right = ComputeQuadrant(bounds.GetCenter(), bounds.GetRightTop(),
584 radii.top_right, {-1, 1}),
585 .all_corners_same = true,
586 };
587 }
588 Scalar top_split = Split(bounds.GetLeft(), bounds.GetRight(),
589 radii.top_left.width, radii.top_right.width);
590 Scalar right_split = Split(bounds.GetTop(), bounds.GetBottom(),
591 radii.top_right.height, radii.bottom_right.height);
592 Scalar bottom_split =
593 Split(bounds.GetLeft(), bounds.GetRight(), radii.bottom_left.width,
594 radii.bottom_right.width);
595 Scalar left_split = Split(bounds.GetTop(), bounds.GetBottom(),
596 radii.top_left.height, radii.bottom_left.height);
597
598 return RoundSuperellipseParam{
599 .top_right =
600 ComputeQuadrant(Point{top_split, right_split}, bounds.GetRightTop(),
601 radii.top_right, {1, -1}),
602 .bottom_right =
603 ComputeQuadrant(Point{bottom_split, right_split},
604 bounds.GetRightBottom(), radii.bottom_right, {1, 1}),
605 .bottom_left =
606 ComputeQuadrant(Point{bottom_split, left_split},
607 bounds.GetLeftBottom(), radii.bottom_left, {-1, 1}),
608 .top_left =
609 ComputeQuadrant(Point{top_split, left_split}, bounds.GetLeftTop(),
610 radii.top_left, {-1, -1}),
611 .all_corners_same = false,
612 };
613}
float Scalar
Definition scalar.h:19

References impeller::RoundingRadii::AreAllCornersSame(), impeller::RoundingRadii::bottom_left, impeller::RoundingRadii::bottom_right, impeller::TRect< T >::GetBottom(), impeller::TRect< T >::GetCenter(), impeller::TRect< T >::GetLeft(), impeller::TRect< T >::GetLeftBottom(), impeller::TRect< T >::GetLeftTop(), impeller::TRect< T >::GetRight(), impeller::TRect< T >::GetRightBottom(), impeller::TRect< T >::GetRightTop(), impeller::TRect< T >::GetTop(), impeller::TSize< T >::height, impeller::TSize< T >::IsEmpty(), impeller::RoundingRadii::top_left, top_right, impeller::RoundingRadii::top_right, and impeller::TSize< T >::width.

Referenced by flutter::DlPathBuilder::AddRoundSuperellipse(), impeller::RoundSuperellipse::Contains(), impeller::RoundSuperellipsePathSource::Dispatch(), impeller::Canvas::DrawRoundSuperellipse(), flutter::RSuperellipse::param(), and flutter::DisplayListMatrixClipState::TransformedRoundSuperellipseCoversBounds().

◆ MakeBoundsRadius()

RoundSuperellipseParam impeller::RoundSuperellipseParam::MakeBoundsRadius ( const Rect bounds,
Scalar  radius 
)
static

Definition at line 566 of file round_superellipse_param.cc.

568 {
569 return RoundSuperellipseParam{
570 .top_right = ComputeQuadrant(bounds.GetCenter(), bounds.GetRightTop(),
571 {radius, radius}, {-1, 1}),
572 .all_corners_same = true,
573 };
574}

References impeller::TRect< T >::GetCenter(), impeller::TRect< T >::GetRightTop(), and top_right.

Member Data Documentation

◆ all_corners_same

bool impeller::RoundSuperellipseParam::all_corners_same

Definition at line 97 of file round_superellipse_param.h.

Referenced by Contains(), and Dispatch().

◆ bottom_left

Quadrant impeller::RoundSuperellipseParam::bottom_left

Definition at line 93 of file round_superellipse_param.h.

Referenced by Contains(), and Dispatch().

◆ bottom_right

Quadrant impeller::RoundSuperellipseParam::bottom_right

Definition at line 92 of file round_superellipse_param.h.

Referenced by Contains(), and Dispatch().

◆ kGapFactor

constexpr Scalar impeller::RoundSuperellipseParam::kGapFactor = 0.29289321881f
staticconstexpr

Definition at line 129 of file round_superellipse_param.h.

◆ top_left

Quadrant impeller::RoundSuperellipseParam::top_left

Definition at line 94 of file round_superellipse_param.h.

Referenced by Contains(), and Dispatch().

◆ top_right

Quadrant impeller::RoundSuperellipseParam::top_right

Definition at line 91 of file round_superellipse_param.h.

Referenced by Contains(), Dispatch(), MakeBoundsRadii(), and MakeBoundsRadius().


The documentation for this struct was generated from the following files: