| Flutter Impeller |

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
impeller::TSize< T > Struct Template Reference

`#include <size.h>`

## Public Types
using | Type = T

## Public Member Functions
constexpr | TSize ()
constexpr | TSize (Type width, Type height)
constexpr | TSize (Type dimension)
template<class U >
constexpr | TSize (const TSize< U > &other)
constexpr TSize | operator* (Scalar scale) const
template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
TSize | operator*= (U scale)
constexpr TSize | operator/ (Scalar scale) const
constexpr TSize | operator/ (const TSize &s) const
constexpr bool | operator== (const TSize &s) const
constexpr bool | operator!= (const TSize &s) const
constexpr TSize | operator+ (const TSize &s) const
constexpr TSize | operator- (const TSize &s) const
constexpr TSize | operator- () const
constexpr TSize | Min (const TSize &o) const
constexpr TSize | Max (const TSize &o) const
constexpr Type | MinDimension () const
constexpr Type | MaxDimension () const
constexpr TSize | Abs () const
constexpr TSize | Floor () const
constexpr TSize | Ceil () const
constexpr TSize | Round () const
constexpr Type | Area () const
constexpr bool | IsEmpty () const
| Returns true if either of the width or height are 0, negative, or NaN. More...
| IsFinite () const
constexpr bool | IsSquare () const
constexpr size_t | MipCount () const
| Return the mip count of the texture. More...

## Static Public Member Functions
static constexpr TSize | MakeWH (Type width, Type height)
static constexpr TSize | Infinite ()
template<class U >
static constexpr TSize | Ceil (const TSize< U > &other)

## Public Attributes
Type | width = {}
Type | height = {}

## Detailed Description

### template<class T>
struct impeller::TSize< T >

Definition at line 25 of file size.h.

## Member Typedef Documentation

## ◆ Type

template<class T >

using impeller::TSize< T >::Type = T

Definition at line 26 of file size.h.

## Constructor & Destructor Documentation

## ◆ TSize() [1/4]

template<class T >

constexpr impeller::TSize< T >::TSize | ( |  | ) |
| inline constexpr

Definition at line 31 of file size.h.

31 {}

## ◆ TSize() [2/4]

template<class T >

constexpr impeller::TSize< T >::TSize | ( | Type | width,
|  | Type | height
| ) |  |
| inline constexpr

Definition at line 33 of file size.h.

33 : width(width), height(height) {}
impeller::TSize::height
Type height
Definition: size.h:29
impeller::TSize::width
Type width
Definition: size.h:28

## ◆ TSize() [3/4]

template<class T >

constexpr impeller::TSize< T >::TSize | ( | Type | dimension | ) |
| inline explicit constexpr

Definition at line 35 of file size.h.

36 : width(dimension), height(dimension) {}

## ◆ TSize() [4/4]

template<class T >
template<class U >

constexpr impeller::TSize< T >::TSize | ( | const TSize< U > & | other | ) |
| inline explicit constexpr

Definition at line 39 of file size.h.

40 : TSize(static_cast<Type>(other.width), static_cast<Type>(other.height)) {
41 }
impeller::TSize::Type
T Type
Definition: size.h:26
impeller::TSize::TSize
constexpr TSize()
Definition: size.h:31

## Member Function Documentation

## ◆ Abs()

template<class T >

constexpr TSize impeller::TSize< T >::Abs | ( |  | ) | const
| inline constexpr

Definition at line 108 of file size.h.

108 { return {std::fabs(width), std::fabs(height)}; }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ Area()

template<class T >

constexpr Type impeller::TSize< T >::Area | ( |  | ) | const
| inline constexpr

Definition at line 120 of file size.h.

120 { return width * height; }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

Referenced by impeller::DecompressedImage::ConvertToRGBA(), impeller::TextureDescriptor::GetByteSizeOfAllMipLevels(), impeller::TextureDescriptor::GetByteSizeOfBaseMipLevel(), and impeller::UpdateAtlasBitmap().

## ◆ Ceil() [1/2]

template<class T >

constexpr TSize impeller::TSize< T >::Ceil | ( |  | ) | const
| inline constexpr

Definition at line 114 of file size.h.

114 { return {std::ceil(width), std::ceil(height)}; }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

Referenced by impeller::AppendToExistingAtlas(), impeller::PairsFitInAtlasOfSize(), and impeller::Contents::RenderToSnapshot().

## ◆ Ceil() [2/2]

template<class T >
template<class U >

static constexpr TSize impeller::TSize< T >::Ceil | ( | const TSize< U > & | other | ) |
| inline static constexpr

Definition at line 131 of file size.h.

131 {
132 return TSize{static_cast<Type>(std::ceil(other.width)),
133 static_cast<Type>(std::ceil(other.height))};
134 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ Floor()

template<class T >

constexpr TSize impeller::TSize< T >::Floor | ( |  | ) | const
| inline constexpr

Definition at line 110 of file size.h.

110 {
111 return {std::floor(width), std::floor(height)};
112 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ Infinite()

template<class T >

static constexpr TSize impeller::TSize< T >::Infinite | ( |  | ) |
| inline static constexpr

Definition at line 47 of file size.h.

47 {
48 return TSize{std::numeric_limits<Type>::max(),
49 std::numeric_limits<Type>::max()};
50 }

## ◆ IsEmpty()

template<class T >

constexpr bool impeller::TSize< T >::IsEmpty | ( |  | ) | const
| inline constexpr

Returns true if either of the width or height are 0, negative, or NaN.

Definition at line 123 of file size.h.

123 { return !(width > 0 && height > 0); }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

Referenced by impeller::AppendToExistingAtlas(), impeller::RoundingRadii::AreAllCornersEmpty(), impeller::BulkUpdateAtlasBitmap(), impeller::CornerContains(), impeller::TypographerContextSkia::CreateGlyphAtlas(), impeller::RenderTargetAllocator::CreateOffscreen(), impeller::RenderTargetCache::CreateOffscreen(), impeller::RenderTargetAllocator::CreateOffscreenMSAA(), impeller::RenderTargetCache::CreateOffscreenMSAA(), impeller::Canvas::DrawImageRect(), impeller::TextureDescriptor::IsValid(), impeller::RoundSuperellipseParam::MakeBoundsRadii(), impeller::TSize< T >::MipCount(), impeller::NormalizeEmptyToZero(), impeller::PairsFitInAtlasOfSize(), and impeller::UpdateAtlasBitmap().

## ◆ IsFinite()

template<class T >

impeller::TSize< T >::IsFinite | ( |  | ) | const
| inline

Definition at line 126 of file size.h.

126 { return std::isfinite(width) && std::isfinite(height); }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

Referenced by impeller::RoundRect::IsFinite(), impeller::RoundSuperellipse::IsFinite(), and impeller::RoundingRadii::IsFinite().

## ◆ IsSquare()

template<class T >

constexpr bool impeller::TSize< T >::IsSquare | ( |  | ) | const
| inline constexpr

Definition at line 128 of file size.h.

128 { return width == height; }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ MakeWH()

template<class T >

static constexpr TSize impeller::TSize< T >::MakeWH | ( | Type | width,
|  | Type | height
| ) |  |
| inline static constexpr

Definition at line 43 of file size.h.

43 {
44 return TSize{width, height};
45 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

Referenced by impeller::KHRSwapchainImplVK::GetCurrentUnderlyingSurfaceSize(), impeller::android::NativeWindow::GetSize(), impeller::interop::SwapchainVK::SwapchainVK(), and impeller::interop::ToImpellerType().

## ◆ Max()

template<class T >

constexpr TSize impeller::TSize< T >::Max | ( | const TSize< T > & | o | ) | const
| inline constexpr

Definition at line 97 of file size.h.

97 {
98 return {
99 std::max(width, o.width),
100 std::max(height, o.height),
101 };
102 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

Referenced by impeller::android::HardwareBufferDescriptor::MakeForSwapchainImage(), and impeller::Playground::OpenPlaygroundHere().

## ◆ MaxDimension()

template<class T >

constexpr Type impeller::TSize< T >::MaxDimension | ( |  | ) | const
| inline constexpr

Definition at line 106 of file size.h.

106 { return std::max(width, height); }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

Referenced by impeller::ArcStrokeGeometry::Dispatch(), impeller::Tessellator::FilledArc(), impeller::Tessellator::FilledRoundRect(), impeller::StrokePathSegmentReceiver::RecordArc(), and impeller::Tessellator::StrokedArc().

## ◆ Min()

template<class T >

constexpr TSize impeller::TSize< T >::Min | ( | const TSize< T > & | o | ) | const
| inline constexpr

Definition at line 90 of file size.h.

90 {
91 return {
92 std::min(width, o.width),
93 std::min(height, o.height),
94 };
95 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ MinDimension()

template<class T >

constexpr Type impeller::TSize< T >::MinDimension | ( |  | ) | const
| inline constexpr

Definition at line 104 of file size.h.

104 { return std::min(width, height); }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ MipCount()

template<class T >

constexpr size_t impeller::TSize< T >::MipCount | ( |  | ) | const
| inline constexpr

Return the mip count of the texture.

Definition at line 137 of file size.h.

137 {
138 constexpr size_t minimum_mip = 1u;
139 if (IsEmpty() || width <= 0 || height <= 0) {
140 return minimum_mip;
141 }
142 size_t result = std::min(log2(width), log2(height));
143 return std::max(result, minimum_mip);
144 }
impeller::TSize::IsEmpty
constexpr bool IsEmpty() const
Returns true if either of the width or height are 0, negative, or NaN.
Definition: size.h:123

References impeller::TSize< T >::height, impeller::TSize< T >::IsEmpty(), and impeller::TSize< T >::width.

Referenced by impeller::Allocator::CreateTexture(), impeller::CreateTextureForDecompressedImage(), impeller::DisplayListToTexture(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ operator!=()

template<class T >

constexpr bool impeller::TSize< T >::operator!= | ( | const TSize< T > & | s | ) | const
| inline constexpr

Definition at line 76 of file size.h.

76 {
77 return s.width != width || s.height != height;
78 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ operator*()

template<class T >

constexpr TSize impeller::TSize< T >::operator* | ( | Scalar | scale | ) | const
| inline constexpr

Definition at line 52 of file size.h.

52 {
53 return {width * scale, height * scale};
54 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ operator*=()

template<class T >
template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>

TSize impeller::TSize< T >::operator*= | ( | U | scale | ) |
| inline

Definition at line 57 of file size.h.

57 {
58 width *= static_cast<Type>(scale);
59 height *= static_cast<Type>(scale);
60 return *this;
61 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ operator+()

template<class T >

constexpr TSize impeller::TSize< T >::operator+ | ( | const TSize< T > & | s | ) | const
| inline constexpr

Definition at line 80 of file size.h.

80 {
81 return {width + s.width, height + s.height};
82 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ operator-() [1/2]

template<class T >

constexpr TSize impeller::TSize< T >::operator- | ( |  | ) | const
| inline constexpr

Definition at line 88 of file size.h.

88 { return {-width, -height}; }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ operator-() [2/2]

template<class T >

constexpr TSize impeller::TSize< T >::operator- | ( | const TSize< T > & | s | ) | const
| inline constexpr

Definition at line 84 of file size.h.

84 {
85 return {width - s.width, height - s.height};
86 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ operator/() [1/2]

template<class T >

constexpr TSize impeller::TSize< T >::operator/ | ( | const TSize< T > & | s | ) | const
| inline constexpr

Definition at line 68 of file size.h.

68 {
69 return {width / s.width, height / s.height};
70 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ operator/() [2/2]

template<class T >

constexpr TSize impeller::TSize< T >::operator/ | ( | Scalar | scale | ) | const
| inline constexpr

Definition at line 63 of file size.h.

63 {
64 return {static_cast<Scalar>(width) / scale,
65 static_cast<Scalar>(height) / scale};
66 }
impeller::Scalar
float Scalar
Definition: scalar.h:19

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ operator==()

template<class T >

constexpr bool impeller::TSize< T >::operator== | ( | const TSize< T > & | s | ) | const
| inline constexpr

Definition at line 72 of file size.h.

72 {
73 return s.width == width && s.height == height;
74 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ Round()

template<class T >

constexpr TSize impeller::TSize< T >::Round | ( |  | ) | const
| inline constexpr

Definition at line 116 of file size.h.

116 {
117 return {std::round(width), std::round(height)};
118 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## Member Data Documentation

## ◆ height

template<class T >

Type impeller::TSize< T >::height = {}

Definition at line 29 of file size.h.

Referenced by impeller::TSize< T >::Abs(), impeller::BlitPass::AddCopy(), impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::AppendToExistingAtlas(), impeller::TSize< T >::Area(), impeller::RoundingRadii::AreAllCornersSame(), impeller::GaussianBlurFilterContents::CalculateUVs(), impeller::TSize< T >::Ceil(), impeller::ComputeNextAtlasSize(), impeller::CornerContains(), impeller::RoundRectGeometry::CoversArea(), impeller::FillRoundRectGeometry::CoversArea(), impeller::RoundSuperellipseGeometry::CoversArea(), impeller::Allocator::CreateTexture(), impeller::DisplayListToTexture(), impeller::EncodeCommandsInReactor(), impeller::TRect< T >::Expand(), impeller::Tessellator::FilledRoundRect(), impeller::TSize< T >::Floor(), impeller::TextureDescriptor::GetByteSizeOfAllMipLevels(), impeller::GetImageInfo(), impeller::RSTransform::GetQuad(), impeller::RenderTargetConfig::Hash(), impeller::TSize< T >::IsEmpty(), impeller::TSize< T >::IsFinite(), impeller::RoundRect::IsOval(), impeller::RoundSuperellipse::IsOval(), impeller::TSize< T >::IsSquare(), impeller::RoundSuperellipseParam::MakeBoundsRadii(), impeller::TRect< T >::MakeOriginSize(), impeller::Matrix::MakeOrthographic(), impeller::Matrix::MakePerspective(), impeller::TRect< T >::MakeSize(), impeller::TSize< T >::MakeWH(), impeller::TSize< T >::Max(), impeller::TSize< T >::MaxDimension(), impeller::TSize< T >::Min(), impeller::TSize< T >::MinDimension(), impeller::TSize< T >::MipCount(), impeller::AiksPlayground::OpenPlaygroundHere(), impeller::DlPlayground::OpenPlaygroundHere(), impeller::TSize< T >::operator!=(), impeller::Trig::operator*(), impeller::TPoint< T >::operator*(), impeller::TSize< T >::operator*(), impeller::TPoint< T >::operator*=(), impeller::TSize< T >::operator*=(), impeller::TSize< T >::operator+(), impeller::TPoint< T >::operator+(), impeller::TPoint< T >::operator+=(), impeller::TSize< T >::operator-(), impeller::TPoint< T >::operator-(), impeller::operator-(), impeller::TPoint< T >::operator-=(), impeller::TPoint< T >::operator/(), impeller::operator/(), impeller::TSize< T >::operator/(), impeller::TPoint< T >::operator/=(), std::operator<<(), impeller::TSize< T >::operator==(), impeller::PairsFitInAtlasOfSize(), impeller::TSize< T >::Round(), impeller::interop::DisplayListBuilder::Scale(), impeller::TRect< T >::Scale(), impeller::RoundingRadii::Scaled(), SizeNear(), impeller::SizeToPoint(), impeller::testing::TEST(), impeller::testing::TEST_P(), impeller::android::ToAHardwareBufferDesc(), impeller::ToMTLTextureDescriptor(), impeller::interop::ToSkiaVector(), and impeller::UpdateAtlasBitmap().

## ◆ width

template<class T >

Type impeller::TSize< T >::width = {}

Definition at line 28 of file size.h.

Referenced by impeller::TSize< T >::Abs(), impeller::BlitPass::AddCopy(), impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::AppendToExistingAtlas(), impeller::TSize< T >::Area(), impeller::RoundingRadii::AreAllCornersSame(), impeller::GaussianBlurFilterContents::CalculateUVs(), impeller::TSize< T >::Ceil(), impeller::ComputeNextAtlasSize(), impeller::CornerContains(), impeller::RoundRectGeometry::CoversArea(), impeller::FillRoundRectGeometry::CoversArea(), impeller::RoundSuperellipseGeometry::CoversArea(), impeller::Allocator::CreateTexture(), impeller::DisplayListToTexture(), impeller::TRect< T >::Expand(), impeller::Tessellator::FilledRoundRect(), impeller::TSize< T >::Floor(), impeller::TextureDescriptor::GetByteSizeOfAllMipLevels(), impeller::TextureDescriptor::GetBytesPerRow(), impeller::GetImageInfo(), impeller::RSTransform::GetQuad(), impeller::RenderTargetConfig::Hash(), impeller::TSize< T >::IsEmpty(), impeller::TSize< T >::IsFinite(), impeller::RoundRect::IsOval(), impeller::RoundSuperellipse::IsOval(), impeller::TSize< T >::IsSquare(), impeller::RoundSuperellipseParam::MakeBoundsRadii(), impeller::TRect< T >::MakeOriginSize(), impeller::Matrix::MakeOrthographic(), impeller::Matrix::MakePerspective(), impeller::TRect< T >::MakeSize(), impeller::TSize< T >::MakeWH(), impeller::TSize< T >::Max(), impeller::TSize< T >::MaxDimension(), impeller::TSize< T >::Min(), impeller::TSize< T >::MinDimension(), impeller::TSize< T >::MipCount(), impeller::AiksPlayground::OpenPlaygroundHere(), impeller::DlPlayground::OpenPlaygroundHere(), impeller::TSize< T >::operator!=(), impeller::Trig::operator*(), impeller::TPoint< T >::operator*(), impeller::TSize< T >::operator*(), impeller::TPoint< T >::operator*=(), impeller::TSize< T >::operator*=(), impeller::TSize< T >::operator+(), impeller::TPoint< T >::operator+(), impeller::TPoint< T >::operator+=(), impeller::TSize< T >::operator-(), impeller::TPoint< T >::operator-(), impeller::operator-(), impeller::TPoint< T >::operator-=(), impeller::TPoint< T >::operator/(), impeller::operator/(), impeller::TSize< T >::operator/(), impeller::TPoint< T >::operator/=(), std::operator<<(), impeller::TSize< T >::operator==(), impeller::PairsFitInAtlasOfSize(), impeller::TSize< T >::Round(), impeller::interop::DisplayListBuilder::Scale(), impeller::TRect< T >::Scale(), impeller::RoundingRadii::Scaled(), SizeNear(), impeller::SizeToPoint(), impeller::testing::TEST(), impeller::testing::TEST_P(), impeller::android::ToAHardwareBufferDesc(), impeller::ToMTLTextureDescriptor(), impeller::interop::ToSkiaVector(), and impeller::UpdateAtlasBitmap().

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

- impeller/geometry/size.h