Flutter Engine
 
Loading...
Searching...
No Matches
impeller::RoundingRadii Struct Reference

#include <rounding_radii.h>

Public Member Functions

constexpr bool IsFinite () const
 
constexpr bool AreAllCornersEmpty () const
 
constexpr bool AreAllCornersSame (Scalar tolerance=kEhCloseEnough) const
 
RoundingRadii Scaled (const Rect &bounds) const
 Returns a scaled copy of this object, ensuring that the sum of the corner radii on each side does not exceed the width or height of the given bounds.
 
constexpr RoundingRadii operator* (Scalar scale)
 
constexpr bool operator== (const RoundingRadii &rr) const
 

Static Public Member Functions

static constexpr RoundingRadii MakeRadius (Scalar radius)
 
static constexpr RoundingRadii MakeRadii (Size radii)
 
static constexpr RoundingRadii MakeNinePatch (Scalar left, Scalar top, Scalar right, Scalar bottom)
 

Public Attributes

Size top_left
 
Size top_right
 
Size bottom_left
 
Size bottom_right
 

Detailed Description

Definition at line 14 of file rounding_radii.h.

Member Function Documentation

◆ AreAllCornersEmpty()

◆ AreAllCornersSame()

constexpr bool impeller::RoundingRadii::AreAllCornersSame ( Scalar  tolerance = kEhCloseEnough) const
inlineconstexpr

◆ IsFinite()

◆ MakeNinePatch()

static constexpr RoundingRadii impeller::RoundingRadii::MakeNinePatch ( Scalar  left,
Scalar  top,
Scalar  right,
Scalar  bottom 
)
inlinestaticconstexpr

Definition at line 28 of file rounding_radii.h.

31 {
32 return {
33 .top_left = Size{left, top},
34 .top_right = Size{right, top},
35 .bottom_left = Size(left, bottom),
36 .bottom_right = Size(right, bottom),
37 };
38 }
TSize< Scalar > Size
Definition size.h:159

References top_left.

Referenced by impeller::RoundRect::MakeNinePatch().

◆ MakeRadii()

static constexpr RoundingRadii impeller::RoundingRadii::MakeRadii ( Size  radii)
inlinestaticconstexpr

◆ MakeRadius()

static constexpr RoundingRadii impeller::RoundingRadii::MakeRadius ( Scalar  radius)
inlinestaticconstexpr

Definition at line 20 of file rounding_radii.h.

20 {
21 return {Size(radius), Size(radius), Size(radius), Size(radius)};
22 }

Referenced by impeller::RoundRect::MakeRectRadius(), impeller::RoundSuperellipse::MakeRectRadius(), impeller::testing::TEST(), and impeller::testing::TEST().

◆ operator*()

constexpr RoundingRadii impeller::RoundingRadii::operator* ( Scalar  scale)
inlineconstexpr

Definition at line 72 of file rounding_radii.h.

72 {
73 return {
74 .top_left = top_left * scale,
75 .top_right = top_right * scale,
76 .bottom_left = bottom_left * scale,
77 .bottom_right = bottom_right * scale,
78 };
79 }

References bottom_left, bottom_right, top_left, and top_right.

◆ operator==()

constexpr bool impeller::RoundingRadii::operator== ( const RoundingRadii rr) const
inlineconstexpr

Definition at line 81 of file rounding_radii.h.

81 {
82 return top_left == rr.top_left && //
83 top_right == rr.top_right && //
84 bottom_left == rr.bottom_left && //
85 bottom_right == rr.bottom_right;
86 }

References bottom_left, bottom_right, top_left, and top_right.

◆ Scaled()

RoundingRadii impeller::RoundingRadii::Scaled ( const Rect bounds) const

Returns a scaled copy of this object, ensuring that the sum of the corner radii on each side does not exceed the width or height of the given bounds.

See the Skia scaling implementation for more details.

Definition at line 26 of file rounding_radii.cc.

26 {
27 Rect bounds = in_bounds.GetPositive();
28 if (bounds.IsEmpty() || //
30 // Normalize empty radii.
31 return RoundingRadii();
32 }
33
34 // Copy the incoming radii so that we can work on normalizing them to the
35 // particular rectangle they are paired with without disturbing the caller.
36 RoundingRadii radii = *this;
37
38 // If any corner is flat or has a negative value, normalize it to zeros
39 // We do this first so that the unnecessary non-flat part of that radius
40 // does not contribute to the global scaling below.
41 NormalizeEmptyToZero(radii.top_left);
42 NormalizeEmptyToZero(radii.top_right);
43 NormalizeEmptyToZero(radii.bottom_left);
44 NormalizeEmptyToZero(radii.bottom_right);
45
46 // Now determine a global scale to apply to all of the radii to ensure
47 // that none of the adjacent pairs of radius values sum to larger than
48 // the corresponding dimension of the rectangle.
49 Size size = bounds.GetSize();
50 Scalar scale = 1.0f;
51 // clang-format off
52 AdjustScale(radii.top_left.width, radii.top_right.width, size.width,
53 scale);
54 AdjustScale(radii.bottom_left.width, radii.bottom_right.width, size.width,
55 scale);
56 AdjustScale(radii.top_left.height, radii.bottom_left.height, size.height,
57 scale);
58 AdjustScale(radii.top_right.height, radii.bottom_right.height, size.height,
59 scale);
60 // clang-format on
61 if (scale < 1.0f) {
62 radii = radii * scale;
63 }
64
65 return radii;
66}
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
float Scalar
Definition scalar.h:19
TRect< Scalar > Rect
Definition rect.h:788
static void AdjustScale(Scalar &radius1, Scalar &radius2, Scalar dimension, Scalar &scale)
static void NormalizeEmptyToZero(Size &radii)
constexpr bool AreAllCornersEmpty() const
constexpr bool IsFinite() const
constexpr TRect GetPositive() const
Get a version of this rectangle that has a non-negative size.
Definition rect.h:398

References impeller::AdjustScale(), AreAllCornersEmpty(), bottom_left, bottom_right, impeller::TRect< T >::GetPositive(), impeller::TRect< T >::GetSize(), impeller::TSize< T >::height, impeller::TRect< T >::IsEmpty(), IsFinite(), impeller::NormalizeEmptyToZero(), top_left, top_right, and impeller::TSize< T >::width.

Referenced by impeller::RoundRect::MakeRectRadii(), and impeller::RoundSuperellipse::MakeRectRadii().

Member Data Documentation

◆ bottom_left

◆ bottom_right

◆ top_left

Size impeller::RoundingRadii::top_left

Definition at line 15 of file rounding_radii.h.

Referenced by AreAllCornersEmpty(), AreAllCornersSame(), flutter::testing::BM_DrawDRRect(), flutter::testing::BM_DrawRRect(), impeller::DlDispatcherBase::clipPath(), impeller::DlDispatcherBase::clipRoundRect(), impeller::RoundRect::Contains(), impeller::FillRoundRectGeometry::CoversArea(), impeller::RoundSuperellipseGeometry::CoversArea(), Skwasm::createDlRadii(), flutter::PlatformViewAndroidJNIImpl::FlutterViewOnDisplayPlatformView(), tonic::DartConverter< flutter::RRect >::FromDart(), impeller::RoundRect::IsFinite(), impeller::RoundSuperellipse::IsFinite(), IsFinite(), impeller::RoundRect::IsOval(), impeller::RoundSuperellipse::IsOval(), impeller::RoundSuperellipseParam::MakeBoundsRadii(), MakeNinePatch(), flutter::PlatformViewAndroidJNIImpl::onDisplayPlatformView2(), operator*(), std::operator<<(), operator==(), Scaled(), flutter::testing::TEST(), flutter::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::interop::ToImpellerType(), impeller::interop::ToSkiaType(), flutter::ToSkRRect(), and flutter::DisplayListMatrixClipState::TransformedRRectCoversBounds().

◆ top_right


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