Introduce draw_with_bounds to canvas::Cache

Also:
  - Change `Rectangle::INFINITE` to have coordinates at `f32::NEG_INFINITY`
  - Change `Frame::with_clip` to _not_ adjust the coordinate system
  - Rename `Size::INFINITY` to `INFINITE`
This commit is contained in:
Héctor Ramón Jiménez 2025-08-17 22:31:58 +02:00
parent c1f7345ceb
commit f2aa570aac
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
13 changed files with 56 additions and 45 deletions

View file

@ -12,7 +12,7 @@ impl Limits {
/// No limits
pub const NONE: Limits = Limits {
min: Size::ZERO,
max: Size::INFINITY,
max: Size::INFINITE,
};
/// Creates new [`Limits`] with the given minimum and maximum [`Size`].

View file

@ -34,8 +34,11 @@ where
}
impl Rectangle<f32> {
/// A rectangle starting at [`Point::ORIGIN`] with infinite width and height.
pub const INFINITE: Self = Self::new(Point::ORIGIN, Size::INFINITY);
/// A rectangle starting at negative infinity and with infinite width and height.
pub const INFINITE: Self = Self::new(
Point::new(f32::NEG_INFINITY, f32::NEG_INFINITY),
Size::INFINITE,
);
/// Creates a new [`Rectangle`] with its top-left corner in the given
/// [`Point`] and with the provided [`Size`].

View file

@ -24,7 +24,7 @@ impl Size {
pub const UNIT: Size = Size::new(1., 1.);
/// A [`Size`] with infinite width and height.
pub const INFINITY: Size = Size::new(f32::INFINITY, f32::INFINITY);
pub const INFINITE: Size = Size::new(f32::INFINITY, f32::INFINITY);
/// Returns the minimum of each component of this size and another.
pub fn min(self, other: Self) -> Self {