#include <rect.h>
Public Member Functions | |
constexpr | TRect () |
constexpr bool | operator== (const TRect &r) const |
constexpr bool | operator!= (const TRect &r) const |
constexpr TRect | Scale (Type scale) const |
constexpr TRect | Scale (Type scale_x, Type scale_y) const |
constexpr TRect | Scale (TPoint< T > scale) const |
constexpr TRect | Scale (TSize< T > scale) const |
constexpr bool | Contains (const TPoint< Type > &p) const |
Returns true iff the provided point |p| is inside the half-open interior of this rectangle. More... | |
constexpr bool | ContainsInclusive (const TPoint< Type > &p) const |
Returns true iff the provided point |p| is inside the closed-range interior of this rectangle. More... | |
constexpr bool | Contains (const TRect &o) const |
Returns true iff this rectangle is not empty and it also contains every point considered inside the provided rectangle |o| (as determined by |Contains(TPoint)|). More... | |
IsFinite () const | |
Returns true if all of the fields of this floating point rectangle are finite. More... | |
constexpr bool | IsEmpty () const |
Returns true if either of the width or height are 0, negative, or NaN. More... | |
constexpr bool | IsSquare () const |
Returns true if width and height are equal and neither is NaN. More... | |
constexpr bool | IsMaximum () const |
constexpr TPoint< Type > | GetOrigin () const |
Returns the upper left corner of the rectangle as specified by the left/top or x/y values when it was constructed. More... | |
constexpr TSize< Type > | GetSize () const |
Returns the size of the rectangle which may be negative in either width or height and may have been clipped to the maximum integer values for integer rects whose size overflows. More... | |
constexpr Type | GetX () const |
Returns the X coordinate of the upper left corner, equivalent to |GetOrigin().x|. More... | |
constexpr Type | GetY () const |
Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|. More... | |
constexpr Type | GetWidth () const |
Returns the width of the rectangle, equivalent to |GetSize().width|. More... | |
constexpr Type | GetHeight () const |
Returns the height of the rectangle, equivalent to |GetSize().height|. More... | |
constexpr auto | GetLeft () const |
constexpr auto | GetTop () const |
constexpr auto | GetRight () const |
constexpr auto | GetBottom () const |
constexpr TPoint< T > | GetLeftTop () const |
constexpr TPoint< T > | GetRightTop () const |
constexpr TPoint< T > | GetLeftBottom () const |
constexpr TPoint< T > | GetRightBottom () const |
constexpr T | Area () const |
Get the area of the rectangle, equivalent to |GetSize().Area()|. More... | |
constexpr Point | GetCenter () const |
Get the center point as a |Point|. More... | |
constexpr std::array< T, 4 > | GetLTRB () const |
constexpr std::array< T, 4 > | GetXYWH () const |
Get the x, y coordinates of the origin and the width and height of the rectangle in an array. More... | |
constexpr TRect | GetPositive () const |
Get a version of this rectangle that has a non-negative size. More... | |
constexpr std::array< TPoint< T >, 4 > | GetPoints () const |
Get the points that represent the 4 corners of this rectangle in a Z order that is compatible with triangle strips or a set of all zero points if the rectangle is empty. The order is: Top left, top right, bottom left, bottom right. More... | |
constexpr std::array< TPoint< T >, 4 > | GetTransformedPoints (const Matrix &transform) const |
constexpr TRect | TransformAndClipBounds (const Matrix &transform) const |
Creates a new bounding box that contains this transformed rectangle, clipped against the near clipping plane if necessary. More... | |
constexpr TRect | TransformBounds (const Matrix &transform) const |
Creates a new bounding box that contains this transformed rectangle. More... | |
constexpr Matrix | GetNormalizingTransform () const |
Constructs a Matrix that will map all points in the coordinate space of the rectangle into a new normalized coordinate space where the upper left corner of the rectangle maps to (0, 0) and the lower right corner of the rectangle maps to (1, 1). More... | |
constexpr TRect | Union (const TRect &o) const |
constexpr std::optional< TRect > | Intersection (const TRect &o) const |
constexpr TRect | IntersectionOrEmpty (const TRect &o) const |
constexpr bool | IntersectsWithRect (const TRect &o) const |
constexpr std::optional< TRect< T > > | Cutout (const TRect &o) const |
Returns the new boundary rectangle that would result from this rectangle being cut out by the specified rectangle. More... | |
constexpr TRect | CutoutOrEmpty (const TRect &o) const |
constexpr TRect< T > | Shift (T dx, T dy) const |
Returns a new rectangle translated by the given offset. More... | |
constexpr TRect< T > | Shift (TPoint< T > offset) const |
Returns a new rectangle translated by the given offset. More... | |
constexpr TRect< T > | Expand (T left, T top, T right, T bottom) const |
Returns a rectangle with expanded edges. Negative expansion results in shrinking. More... | |
constexpr TRect< T > | Expand (T amount) const |
Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking. More... | |
constexpr TRect< T > | Expand (T horizontal_amount, T vertical_amount) const |
Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking. More... | |
constexpr TRect< T > | Expand (TPoint< T > amount) const |
Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking. More... | |
constexpr TRect< T > | Expand (TSize< T > amount) const |
Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking. More... | |
constexpr TRect< T > | Project (TRect< T > source) const |
Returns a new rectangle that represents the projection of the source rectangle onto this rectangle. In other words, the source rectangle is redefined in terms of the coordinate space of this rectangle. More... | |
RoundOut (const TRect< U > &r) | |
RoundIn (const TRect< U > &r) | |
Round (const TRect< U > &r) | |
Static Public Member Functions | |
constexpr static TRect | MakeLTRB (Type left, Type top, Type right, Type bottom) |
constexpr static TRect | MakeXYWH (Type x, Type y, Type width, Type height) |
constexpr static TRect | MakeWH (Type width, Type height) |
constexpr static TRect | MakeOriginSize (const TPoint< Type > &origin, const TSize< Type > &size) |
template<class U > | |
constexpr static TRect | MakeSize (const TSize< U > &size) |
template<class U , class FT = T> | |
constexpr static std::enable_if_t< std::is_floating_point_v< FT >, TRect > | Make (const TRect< U > &rect) |
template<typename U > | |
constexpr static std::optional< TRect > | MakePointBounds (const U &value) |
template<typename PointIter > | |
constexpr static std::optional< TRect > | MakePointBounds (const PointIter first, const PointIter last) |
constexpr static TRect | MakeMaximum () |
constexpr static TRect | Union (const TRect &a, const std::optional< TRect > b) |
constexpr static TRect | Union (const std::optional< TRect > a, const TRect &b) |
constexpr static std::optional< TRect > | Union (const std::optional< TRect > a, const std::optional< TRect > b) |
constexpr static std::optional< TRect > | Intersection (const TRect &a, const std::optional< TRect > b) |
constexpr static std::optional< TRect > | Intersection (const std::optional< TRect > a, const TRect &b) |
constexpr static std::optional< TRect > | Intersection (const std::optional< TRect > a, const std::optional< TRect > b) |
Templated struct for holding an axis-aligned rectangle.
Rectangles are defined as 4 axis-aligned edges that might contain space. They can be viewed as 2 X coordinates that define the left and right edges and 2 Y coordinates that define the top and bottom edges; or they can be viewed as an origin and horizontal and vertical dimensions (width and height).
When the left and right edges are equal or reversed (right <= left) or the top and bottom edges are equal or reversed (bottom <= top), the rectangle is considered empty. Considering the rectangle in XYWH form, the width and/or the height would be negative or zero. Such reversed/empty rectangles contain no space and act as such in the methods that operate on them (Intersection, Union, IntersectsWithRect, Contains, Cutout, etc.)
Rectangles cannot be modified by any method and a new value can only be stored into an existing rect using assignment. This keeps the API clean compared to implementations that might have similar methods that produce the answer in place, or construct a new object with the answer, or place the result in an indicated result object.
Methods that might fail to produce an answer will use |std::optional| to indicate that success or failure (see |Intersection| and |CutOut|). For convenience, |Intersection| and |Union| both have overloaded variants that take |std::optional| arguments and treat them as if the argument was an empty rect to allow chaining multiple such methods and only needing to check the optional condition of the final result. The primary methods also provide |...OrEmpty| overloaded variants that translate an empty optional answer into a simple empty rectangle of the same type.
Rounding instance methods are not provided as the return value might be wanted as another floating point rectangle or sometimes as an integer rectangle. Instead a |RoundOut| factory, defined only for floating point input rectangles, is provided to provide control over the result type.
NaN and Infinity values
Constructing an LTRB rectangle using Infinity values should work as expected with either 0 or +Infinity returned as dimensions depending on which side the Infinity values are on and the sign.
Constructing an XYWH rectangle using Infinity values will usually not work if the math requires the object to compute a right or bottom edge from ([xy] -Infinity + [wh] +Infinity). Other combinations might work.
The special factory |MakeMaximum| is provided to construct a rectangle of the indicated coordinate type that covers all finite coordinates. It does not use infinity values, but rather the largest finite values to avoid math that might produce a NaN value from various getters.
Any rectangle that is constructed with, or computed to have a NaN value will be considered the same as any empty rectangle.
Empty Rectangle canonical results summary:
Union will ignore any empty rects and return the other rect Intersection will return nullopt if either rect is empty IntersectsWithRect will return false if either rect is empty Cutout will return the source rect if the argument is empty Cutout will return nullopt if the source rectangle is empty Contains(Point) will return false if the source rectangle is empty Contains(Rect) will return false if the source rectangle is empty Contains(Rect) will otherwise return true if the argument is empty Specifically, EmptyRect.Contains(EmptyRect) returns false
Special notes on problems using the XYWH form of specifying rectangles:
It is possible to have integer rectangles whose dimensions exceed the maximum number that their coordinates can represent since (MAX_INT - MIN_INT) overflows the representable positive numbers. Floating point rectangles technically have a similar issue in that overflow can occur, but it will be automatically converted into either an infinity, or a finite-overflow value and still be representable, just with little to no precision.
Secondly, specifying a rectangle using XYWH leads to cases where the math for (x+w) and/or (y+h) are also beyond the maximum representable coordinates. For N-bit integer rectangles declared as XYWH, the maximum right coordinate will require N+1 signed bits which cannot be stored in storage that uses N-bit integers.
Saturated math is used when constructing a rectangle from XYWH values and when returning the dimensions of the rectangle. Constructing an integer rectangle from values such that xy + wh is beyond the range of the integer type will place the right or bottom edges at the maximum value for the integer type. Similarly, constructing an integer rectangle such that the distance from the left to the right (or top to bottom) is greater than the range of the integer type will simply return the maximum integer value as the dimension. Floating point rectangles are naturally saturated by the rules of IEEE arithmetic.
|
inlineconstexpr |
Definition at line 127 of file rect.h.
Referenced by impeller::TRect< T >::CutoutOrEmpty(), impeller::TRect< T >::IntersectionOrEmpty(), impeller::TRect< T >::MakeLTRB(), impeller::TRect< T >::MakeSize(), impeller::TRect< T >::MakeWH(), impeller::TRect< T >::MakeXYWH(), and impeller::TRect< T >::Scale().
|
inlineconstexpr |
Get the area of the rectangle, equivalent to |GetSize().Area()|.
Definition at line 380 of file rect.h.
References impeller::TRect< T >::IsEmpty().
Referenced by impeller::BlitPass::AddCopy(), and impeller::BlitCopyBufferToTextureCommandGLES::Encode().
|
inlineconstexpr |
Returns true iff the provided point |p| is inside the half-open interior of this rectangle.
For purposes of containment, a rectangle contains points along the top and left edges but not points along the right and bottom edges so that a point is only ever considered inside one of two abutting rectangles.
Definition at line 235 of file rect.h.
References impeller::TRect< T >::IsEmpty(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
Referenced by impeller::RoundRect::Contains(), impeller::RoundSuperellipse::Contains(), impeller::FillPathSourceGeometry::CoversArea(), impeller::FillRectGeometry::CoversArea(), impeller::RoundRectGeometry::CoversArea(), impeller::FillRoundRectGeometry::CoversArea(), impeller::RoundSuperellipseGeometry::CoversArea(), impeller::TiledTextureContents::RenderToSnapshot(), and impeller::testing::TEST().
|
inlineconstexpr |
Returns true iff this rectangle is not empty and it also contains every point considered inside the provided rectangle |o| (as determined by |Contains(TPoint)|).
This is similar to a definition where the result is true iff the union of the two rectangles is equal to this rectangle, ignoring precision issues with performing those operations and assuming that empty rectangles are never equal.
An empty rectangle can contain no other rectangle.
An empty rectangle is, however, contained within any other non-empy rectangle as the set of points it contains is an empty set and so there are no points to fail the containment criteria.
Definition at line 277 of file rect.h.
References impeller::TRect< T >::IsEmpty().
|
inlineconstexpr |
Returns true iff the provided point |p| is inside the closed-range interior of this rectangle.
Unlike the regular |Contains(TPoint)| method, this method considers all points along the boundary of the rectangle to be contained within the rectangle - useful for testing if vertices that define a filled shape would carry the interior of that shape outside the bounds of the rectangle. Since both geometries are defining half-open spaces, their defining geometry needs to consider their boundaries to be equivalent with respect to interior and exterior.
Definition at line 254 of file rect.h.
References impeller::TRect< T >::IsEmpty(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
Referenced by impeller::testing::TEST().
|
inlineconstexpr |
Returns the new boundary rectangle that would result from this rectangle being cut out by the specified rectangle.
Definition at line 561 of file rect.h.
References impeller::TRect< T >::GetLTRB(), impeller::TRect< T >::IsEmpty(), and impeller::TRect< T >::MakeLTRB().
Referenced by impeller::TRect< T >::CutoutOrEmpty(), and impeller::testing::TEST().
|
inlineconstexpr |
Definition at line 601 of file rect.h.
References impeller::TRect< T >::Cutout(), and impeller::TRect< T >::TRect().
Referenced by impeller::testing::TEST().
|
inlineconstexpr |
Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking.
|
inlineconstexpr |
Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking.
|
inlineconstexpr |
Returns a rectangle with expanded edges. Negative expansion results in shrinking.
Definition at line 622 of file rect.h.
Referenced by impeller::RoundRectGeometry::CoversArea(), impeller::FillRoundRectGeometry::CoversArea(), impeller::Canvas::DrawArc(), impeller::RoundRect::Expand(), impeller::RoundSuperellipse::Expand(), impeller::TRect< T >::Expand(), impeller::SolidRRectLikeBlurContents::GetCoverage(), impeller::BorderMaskBlurFilterContents::GetFilterCoverage(), impeller::BorderMaskBlurFilterContents::GetFilterSourceCoverage(), impeller::GaussianBlurFilterContents::GetFilterSourceCoverage(), impeller::DirectionalMorphologyFilterContents::GetFilterSourceCoverage(), impeller::StrokeSegmentsGeometry::GetStrokeCoverage(), impeller::TextureContents::Render(), impeller::testing::TEST(), and impeller::testing::TEST_P().
|
inlineconstexpr |
Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking.
Definition at line 659 of file rect.h.
References impeller::TRect< T >::Expand(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
|
inlineconstexpr |
Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking.
Definition at line 665 of file rect.h.
References impeller::TRect< T >::Expand(), impeller::TSize< T >::height, and impeller::TSize< T >::width.
|
inlineconstexpr |
Definition at line 361 of file rect.h.
Referenced by impeller::BlitPass::AddCopy(), impeller::Canvas::Canvas(), impeller::RoundSuperellipseGeometry::CoversArea(), impeller::EllipsePathSource::Dispatch(), impeller::NinePatchConverter::DrawNinePatch(), impeller::StrokeRectGeometry::GetPositionBuffer(), impeller::TRect< T >::Make(), impeller::RoundSuperellipseParam::MakeBoundsRadii(), impeller::EntityPassClipStack::RecordClip(), RectNear(), impeller::AtlasContents::Render(), impeller::testing::swap_nan(), impeller::testing::TEST(), and impeller::testing::TEST_P().
|
inlineconstexpr |
Get the center point as a |Point|.
Definition at line 386 of file rect.h.
Referenced by impeller::EllipsePathSource::Dispatch(), impeller::Canvas::DrawOval(), impeller::Tessellator::FilledEllipse(), impeller::Arc::GetOvalCenter(), impeller::Arc::GetTightArcBounds(), impeller::RoundSuperellipseParam::MakeBoundsRadii(), impeller::RoundSuperellipseParam::MakeBoundsRadius(), impeller::SolidRRectLikeBlurContents::Render(), and impeller::testing::TEST().
|
inlineconstexpr |
Returns the height of the rectangle, equivalent to |GetSize().height|.
Definition at line 351 of file rect.h.
Referenced by impeller::RoundRectGeometry::CoversArea(), impeller::FillRoundRectGeometry::CoversArea(), impeller::Canvas::DrawImageRect(), impeller::BlitCopyBufferToTextureCommandGLES::Encode(), impeller::BlitCopyTextureToTextureCommandGLES::Encode(), impeller::BlitResizeTextureCommandGLES::Encode(), impeller::Tessellator::FilledRoundRect(), impeller::TRect< T >::GetNormalizingTransform(), impeller::TRect< T >::GetSize(), impeller::TRect< T >::GetXYWH(), impeller::RoundRect::IsOval(), impeller::RoundSuperellipse::IsOval(), impeller::TRect< T >::Project(), impeller::SolidRRectLikeBlurContents::Render(), impeller::PassBindingsCacheMTL::SetScissor(), impeller::PassBindingsCacheMTL::SetViewport(), impeller::testing::TEST(), and impeller::interop::ToSkiaType().
|
inlineconstexpr |
Definition at line 355 of file rect.h.
Referenced by impeller::Canvas::Canvas(), impeller::RoundSuperellipseGeometry::CoversArea(), impeller::EllipsePathSource::Dispatch(), impeller::DrawGlyph(), impeller::Canvas::DrawImageRect(), impeller::NinePatchConverter::DrawNinePatch(), impeller::StrokeRectGeometry::GetPositionBuffer(), impeller::TRect< T >::Make(), impeller::RoundSuperellipseParam::MakeBoundsRadii(), impeller::EntityPassClipStack::RecordClip(), RectNear(), impeller::testing::swap_nan(), impeller::testing::TEST(), and impeller::testing::TEST_P().
|
inlineconstexpr |
Definition at line 371 of file rect.h.
Referenced by impeller::RoundRect::Contains(), impeller::RectPathSource::Dispatch(), impeller::StrokeRectGeometry::GetPositionBuffer(), impeller::RoundSuperellipseParam::MakeBoundsRadii(), impeller::TextureContents::Render(), and impeller::testing::TEST().
|
inlineconstexpr |
Definition at line 363 of file rect.h.
Referenced by impeller::TextContents::ComputeVertexData(), impeller::RoundRect::Contains(), impeller::RectPathSource::Dispatch(), impeller::Tessellator::FilledRoundRect(), impeller::StrokeRectGeometry::GetPositionBuffer(), impeller::RoundSuperellipseParam::MakeBoundsRadii(), std::operator<<(), impeller::TextureContents::Render(), and impeller::testing::TEST().
|
inlineconstexpr |
Definition at line 391 of file rect.h.
Referenced by impeller::TRect< T >::Cutout().
|
inlineconstexpr |
Constructs a Matrix that will map all points in the coordinate space of the rectangle into a new normalized coordinate space where the upper left corner of the rectangle maps to (0, 0) and the lower right corner of the rectangle maps to (1, 1).
Empty and non-finite rectangles will return a zero-scaling transform that maps all points to (0, 0).
Definition at line 495 of file rect.h.
References impeller::TRect< T >::GetHeight(), impeller::TRect< T >::GetWidth(), impeller::TRect< T >::IsEmpty(), and impeller::Matrix::MakeScale().
Referenced by impeller::DlVerticesGeometry::GetPositionUVColorBuffer(), and impeller::TiledTextureContents::Render().
|
inlineconstexpr |
Returns the upper left corner of the rectangle as specified by the left/top or x/y values when it was constructed.
Definition at line 324 of file rect.h.
Referenced by impeller::AdvancedBlend(), impeller::DirectionalMorphologyFilterContents::GetFilterCoverage(), impeller::PipelineBlend(), impeller::SolidRRectLikeBlurContents::Render(), impeller::Canvas::Restore(), and impeller::testing::TEST().
|
inlineconstexpr |
Get the points that represent the 4 corners of this rectangle in a Z order that is compatible with triangle strips or a set of all zero points if the rectangle is empty. The order is: Top left, top right, bottom left, bottom right.
Definition at line 418 of file rect.h.
References impeller::TRect< T >::IsEmpty().
Referenced by impeller::DrawImageRectAtlasGeometry::CreateBlendVertexBuffer(), impeller::DrawImageRectAtlasGeometry::CreateSimpleVertexBuffer(), impeller::FillRectGeometry::GetPositionBuffer(), impeller::TRect< T >::GetTransformedPoints(), impeller::ClipContents::Render(), and impeller::testing::TEST().
|
inlineconstexpr |
Get a version of this rectangle that has a non-negative size.
Definition at line 402 of file rect.h.
References impeller::TRect< T >::IsEmpty().
Referenced by impeller::DashedLinePathSource::GetBounds(), impeller::RoundRect::MakeRectRadii(), impeller::RoundSuperellipse::MakeRectRadii(), impeller::SolidRRectLikeBlurContents::Render(), impeller::RoundingRadii::Scaled(), and impeller::testing::TEST().
|
inlineconstexpr |
Definition at line 359 of file rect.h.
Referenced by impeller::BlitPass::AddCopy(), impeller::Canvas::Canvas(), impeller::RoundSuperellipseGeometry::CoversArea(), impeller::EllipsePathSource::Dispatch(), impeller::NinePatchConverter::DrawNinePatch(), impeller::StrokeRectGeometry::GetPositionBuffer(), impeller::TRect< T >::Make(), impeller::RoundSuperellipseParam::MakeBoundsRadii(), impeller::EntityPassClipStack::RecordClip(), RectNear(), impeller::AtlasContents::Render(), impeller::testing::swap_nan(), impeller::testing::TEST(), and impeller::testing::TEST_P().
|
inlineconstexpr |
Definition at line 375 of file rect.h.
Referenced by impeller::RoundRect::Contains(), impeller::RectPathSource::Dispatch(), impeller::Tessellator::FilledRoundRect(), impeller::StrokeRectGeometry::GetPositionBuffer(), impeller::RoundSuperellipseParam::MakeBoundsRadii(), std::operator<<(), impeller::TextureContents::Render(), and impeller::testing::TEST().
|
inlineconstexpr |
Definition at line 367 of file rect.h.
Referenced by impeller::RoundRect::Contains(), impeller::RectPathSource::Dispatch(), impeller::StrokeRectGeometry::GetPositionBuffer(), impeller::RoundSuperellipseParam::MakeBoundsRadii(), impeller::RoundSuperellipseParam::MakeBoundsRadius(), impeller::TextureContents::Render(), and impeller::testing::TEST().
|
inlineconstexpr |
Returns the size of the rectangle which may be negative in either width or height and may have been clipped to the maximum integer values for integer rects whose size overflows.
Definition at line 331 of file rect.h.
References impeller::TRect< T >::GetHeight(), and impeller::TRect< T >::GetWidth().
Referenced by impeller::AdvancedBlend(), impeller::ComputeSaveLayerCoverage(), impeller::TextContents::ComputeVertexData(), impeller::Canvas::DrawArc(), impeller::Canvas::DrawOval(), impeller::Tessellator::FilledEllipse(), impeller::DirectionalMorphologyFilterContents::GetFilterCoverage(), impeller::Arc::GetOvalSize(), impeller::Arc::GetTightArcBounds(), impeller::RoundRect::MakeOval(), impeller::RoundSuperellipse::MakeOval(), impeller::PipelineBlend(), impeller::SolidRRectLikeBlurContents::Render(), impeller::RoundingRadii::Scaled(), impeller::testing::TEST(), and impeller::testing::TEST_P().
|
inlineconstexpr |
Definition at line 357 of file rect.h.
Referenced by impeller::Canvas::Canvas(), impeller::RoundSuperellipseGeometry::CoversArea(), impeller::EllipsePathSource::Dispatch(), impeller::DrawGlyph(), impeller::Canvas::DrawImageRect(), impeller::NinePatchConverter::DrawNinePatch(), impeller::StrokeRectGeometry::GetPositionBuffer(), impeller::TRect< T >::Make(), impeller::RoundSuperellipseParam::MakeBoundsRadii(), impeller::EntityPassClipStack::RecordClip(), RectNear(), impeller::testing::swap_nan(), impeller::testing::TEST(), and impeller::testing::TEST_P().
|
inlineconstexpr |
Definition at line 430 of file rect.h.
References impeller::TRect< T >::GetPoints(), points, and transform.
Referenced by impeller::GaussianBlurFilterContents::CalculateUVs(), impeller::Snapshot::GetCoverageUVs(), impeller::testing::TEST(), and impeller::TRect< T >::TransformBounds().
|
inlineconstexpr |
Returns the width of the rectangle, equivalent to |GetSize().width|.
Definition at line 345 of file rect.h.
Referenced by impeller::RoundRectGeometry::CoversArea(), impeller::FillRoundRectGeometry::CoversArea(), impeller::Canvas::DrawImageRect(), impeller::Canvas::DrawOval(), impeller::BlitCopyBufferToTextureCommandGLES::Encode(), impeller::BlitCopyTextureToTextureCommandGLES::Encode(), impeller::BlitResizeTextureCommandGLES::Encode(), impeller::Tessellator::FilledEllipse(), impeller::Tessellator::FilledRoundRect(), impeller::TRect< T >::GetNormalizingTransform(), impeller::TRect< T >::GetSize(), impeller::TRect< T >::GetXYWH(), impeller::RoundRect::IsOval(), impeller::RoundSuperellipse::IsOval(), impeller::TRect< T >::Project(), impeller::SolidRRectLikeBlurContents::Render(), impeller::PassBindingsCacheMTL::SetScissor(), impeller::PassBindingsCacheMTL::SetViewport(), impeller::testing::TEST(), and impeller::interop::ToSkiaType().
|
inlineconstexpr |
Returns the X coordinate of the upper left corner, equivalent to |GetOrigin().x|.
Definition at line 337 of file rect.h.
Referenced by impeller::BlitPass::AddCopy(), impeller::BlitCopyBufferToTextureCommandGLES::Encode(), impeller::BlitCopyTextureToTextureCommandGLES::Encode(), impeller::BlitResizeTextureCommandGLES::Encode(), impeller::AtlasContents::Render(), impeller::PassBindingsCacheMTL::SetScissor(), impeller::PassBindingsCacheMTL::SetViewport(), impeller::testing::TEST(), and impeller::interop::ToSkiaType().
|
inlineconstexpr |
Get the x, y coordinates of the origin and the width and height of the rectangle in an array.
Definition at line 397 of file rect.h.
References impeller::TRect< T >::GetHeight(), and impeller::TRect< T >::GetWidth().
Referenced by impeller::testing::TEST().
|
inlineconstexpr |
Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|.
Definition at line 341 of file rect.h.
Referenced by impeller::BlitPass::AddCopy(), impeller::BlitCopyBufferToTextureCommandGLES::Encode(), impeller::BlitCopyTextureToTextureCommandGLES::Encode(), impeller::BlitResizeTextureCommandGLES::Encode(), impeller::AtlasContents::Render(), impeller::PassBindingsCacheMTL::SetScissor(), impeller::PassBindingsCacheMTL::SetViewport(), impeller::testing::TEST(), and impeller::interop::ToSkiaType().
|
inlinestaticconstexpr |
Definition at line 734 of file rect.h.
References impeller::saturated::b, and impeller::TRect< T >::Intersection().
|
inlinestaticconstexpr |
Definition at line 728 of file rect.h.
References impeller::saturated::b.
|
inlinestaticconstexpr |
Definition at line 722 of file rect.h.
References impeller::saturated::b, and impeller::TRect< T >::Intersection().
|
inlineconstexpr |
Definition at line 532 of file rect.h.
References impeller::TRect< T >::IntersectsWithRect().
Referenced by impeller::AdvancedBlend(), impeller::ComputeSaveLayerCoverage(), impeller::Canvas::DrawImageRect(), impeller::Canvas::GetLocalCoverageLimit(), impeller::TRect< T >::Intersection(), impeller::TRect< T >::IntersectionOrEmpty(), impeller::PipelineBlend(), and impeller::testing::TEST().
|
inlineconstexpr |
Definition at line 546 of file rect.h.
References impeller::TRect< T >::Intersection(), and impeller::TRect< T >::TRect().
Referenced by impeller::testing::TEST().
|
inlineconstexpr |
Definition at line 550 of file rect.h.
References impeller::TRect< T >::IsEmpty().
Referenced by impeller::TRect< T >::Intersection(), and impeller::testing::TEST().
|
inlineconstexpr |
Returns true if either of the width or height are 0, negative, or NaN.
Definition at line 301 of file rect.h.
Referenced by impeller::TRect< T >::Area(), impeller::TRect< T >::Contains(), impeller::TRect< T >::ContainsInclusive(), impeller::TRect< T >::Cutout(), impeller::FirstPassDispatcher::drawDisplayList(), impeller::Canvas::DrawImageRect(), impeller::NinePatchConverter::DrawNinePatch(), impeller::ClipContents::GetClipCoverage(), impeller::TRect< T >::GetNormalizingTransform(), impeller::TRect< T >::GetPoints(), impeller::TRect< T >::GetPositive(), impeller::StrokeSegmentsGeometry::GetStrokeCoverage(), impeller::TRect< T >::IntersectsWithRect(), impeller::RoundRect::IsEmpty(), impeller::RoundSuperellipse::IsEmpty(), impeller::RoundRect::IsOval(), impeller::RoundSuperellipse::IsOval(), impeller::RoundRect::IsRect(), impeller::RoundSuperellipse::IsRect(), impeller::TRect< T >::IsSquare(), impeller::TRect< T >::Project(), impeller::TextureContents::Render(), impeller::RoundingRadii::Scaled(), impeller::testing::TEST(), impeller::TRect< T >::TransformAndClipBounds(), impeller::TRect< T >::TransformBounds(), and impeller::TRect< T >::Union().
|
inline |
Returns true if all of the fields of this floating point rectangle are finite.
Note that the results of |GetWidth()| and |GetHeight()| may still be infinite due to overflow even if the fields themselves are finite.
Definition at line 292 of file rect.h.
Referenced by impeller::Arc::Arc(), impeller::RoundRect::IsFinite(), impeller::RoundSuperellipse::IsFinite(), impeller::RoundRect::MakeRectRadii(), impeller::RoundSuperellipse::MakeRectRadii(), and impeller::testing::TEST().
|
inlineconstexpr |
Definition at line 318 of file rect.h.
References impeller::TRect< T >::MakeMaximum().
Referenced by impeller::ComputeSaveLayerCoverage(), and impeller::FirstPassDispatcher::drawDisplayList().
|
inlineconstexpr |
Returns true if width and height are equal and neither is NaN.
Definition at line 308 of file rect.h.
References impeller::TRect< T >::IsEmpty().
Referenced by impeller::Canvas::DrawArc(), impeller::Canvas::DrawOval(), impeller::Tessellator::FilledEllipse(), and impeller::Arc::IsPerfectCircle().
|
inlinestaticconstexpr |
Construct a floating point rect |Rect| from another Rect of a potentially different storage type (eg. |IRect|).
Definition at line 157 of file rect.h.
References impeller::TRect< T >::GetBottom(), impeller::TRect< T >::GetLeft(), impeller::TRect< T >::GetRight(), impeller::TRect< T >::GetTop(), and impeller::TRect< T >::MakeLTRB().
|
inlinestaticconstexpr |
Definition at line 129 of file rect.h.
References impeller::TRect< T >::TRect().
Referenced by impeller::TRect< T >::Cutout(), impeller::TRect< T >::Make(), impeller::TRect< T >::MakeMaximum(), impeller::TRect< T >::MakePointBounds(), impeller::TRect< T >::Round(), impeller::TRect< T >::RoundIn(), impeller::TRect< T >::RoundOut(), impeller::testing::TEST(), and impeller::testing::TEST_P().
|
inlinestaticconstexpr |
Definition at line 188 of file rect.h.
References impeller::TRect< T >::MakeLTRB().
Referenced by impeller::TRect< T >::IsMaximum(), and impeller::testing::TEST().
|
inlinestaticconstexpr |
Definition at line 144 of file rect.h.
References impeller::TSize< T >::height, impeller::TRect< T >::MakeXYWH(), impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
Referenced by impeller::testing::TEST().
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
Definition at line 165 of file rect.h.
References value.
Referenced by impeller::TRect< T >::TransformAndClipBounds(), and impeller::TRect< T >::TransformBounds().
|
inlinestaticconstexpr |
Definition at line 150 of file rect.h.
References impeller::TSize< T >::height, impeller::TRect< T >::TRect(), and impeller::TSize< T >::width.
Referenced by impeller::BlitPass::AddCopy(), impeller::SurfaceMTL::coverage(), impeller::TypographerContextSkia::CreateGlyphAtlas(), impeller::DisplayListToTexture(), and impeller::testing::TEST().
|
inlinestaticconstexpr |
Definition at line 140 of file rect.h.
References impeller::TRect< T >::TRect().
Referenced by impeller::testing::TEST().
|
inlinestaticconstexpr |
Definition at line 136 of file rect.h.
References impeller::TRect< T >::TRect(), and x.
Referenced by impeller::BulkUpdateAtlasBitmap(), impeller::TRect< T >::MakeOriginSize(), impeller::testing::TEST(), and impeller::UpdateAtlasBitmap().
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Returns a new rectangle that represents the projection of the source rectangle onto this rectangle. In other words, the source rectangle is redefined in terms of the coordinate space of this rectangle.
Definition at line 673 of file rect.h.
References impeller::TRect< T >::GetHeight(), impeller::TRect< T >::GetWidth(), impeller::TRect< T >::IsEmpty(), and impeller::TRect< T >::Shift().
Referenced by impeller::DrawImageRectAtlasGeometry::CreateBlendVertexBuffer(), impeller::DrawImageRectAtlasGeometry::CreateSimpleVertexBuffer(), and impeller::TextureContents::Render().
|
inline |
Definition at line 699 of file rect.h.
References impeller::TRect< T >::MakeLTRB().
Referenced by impeller::testing::TEST().
|
inline |
|
inline |
Definition at line 683 of file rect.h.
References impeller::TRect< T >::MakeLTRB().
Referenced by ImGui_ImplImpeller_RenderDrawData(), impeller::RenderToTarget(), impeller::Canvas::SaveLayer(), and impeller::testing::TEST().
|
inlineconstexpr |
Definition at line 220 of file rect.h.
References impeller::TRect< T >::Scale(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
|
inlineconstexpr |
Definition at line 224 of file rect.h.
References impeller::TSize< T >::height, impeller::TRect< T >::Scale(), and impeller::TSize< T >::width.
|
inlineconstexpr |
Definition at line 206 of file rect.h.
References impeller::TRect< T >::TRect().
Referenced by impeller::TextContents::ComputeVertexData(), ImGui_ImplImpeller_RenderDrawData(), impeller::TRect< T >::Scale(), and impeller::testing::TEST().
|
inlineconstexpr |
|
inlineconstexpr |
Returns a new rectangle translated by the given offset.
Definition at line 606 of file rect.h.
Referenced by impeller::Canvas::DrawImage(), impeller::TRect< T >::Project(), impeller::testing::RectMakeCenterSize(), impeller::RoundRect::Shift(), impeller::RoundSuperellipse::Shift(), impeller::TRect< T >::Shift(), and impeller::testing::TEST_P().
|
inlineconstexpr |
Returns a new rectangle translated by the given offset.
Definition at line 616 of file rect.h.
References impeller::TRect< T >::Shift(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
|
inlineconstexpr |
Creates a new bounding box that contains this transformed rectangle, clipped against the near clipping plane if necessary.
Definition at line 442 of file rect.h.
References impeller::TRect< T >::IsEmpty(), impeller::TRect< T >::MakePointBounds(), points, transform, and impeller::TRect< T >::TransformBounds().
Referenced by impeller::testing::TEST().
|
inlineconstexpr |
Creates a new bounding box that contains this transformed rectangle.
Definition at line 476 of file rect.h.
References impeller::TRect< T >::GetTransformedPoints(), impeller::TRect< T >::IsEmpty(), impeller::TRect< T >::MakePointBounds(), points, and transform.
Referenced by impeller::ComputeSaveLayerCoverage(), impeller::FillRectGeometry::CoversArea(), impeller::RoundRectGeometry::CoversArea(), impeller::FillRoundRectGeometry::CoversArea(), impeller::RoundSuperellipseGeometry::CoversArea(), impeller::DlDispatcherBase::drawDisplayList(), impeller::Canvas::DrawImageRect(), impeller::Snapshot::GetCoverage(), impeller::AtlasContents::GetCoverage(), impeller::ColorFilterAtlasContents::GetCoverage(), impeller::SolidRRectLikeBlurContents::GetCoverage(), impeller::TextureContents::GetCoverage(), impeller::DlVerticesGeometry::GetCoverage(), impeller::PointFieldGeometry::GetCoverage(), impeller::FillRectGeometry::GetCoverage(), impeller::StrokeRectGeometry::GetCoverage(), impeller::MatrixFilterContents::GetFilterCoverage(), impeller::LocalMatrixFilterContents::GetFilterSourceCoverage(), impeller::StrokeSegmentsGeometry::GetStrokeCoverage(), impeller::testing::TEST(), and impeller::TRect< T >::TransformAndClipBounds().
|
inlinestaticconstexpr |
Definition at line 716 of file rect.h.
References impeller::saturated::b, and impeller::TRect< T >::Union().
|
inlinestaticconstexpr |
Definition at line 711 of file rect.h.
References impeller::saturated::b, and impeller::TRect< T >::Union().
|
inlinestaticconstexpr |
Definition at line 706 of file rect.h.
References impeller::saturated::b, and impeller::TRect< T >::Union().
|
inlineconstexpr |
Definition at line 517 of file rect.h.
References impeller::TRect< T >::IsEmpty().
Referenced by impeller::testing::TEST(), and impeller::TRect< T >::Union().