1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30:03 -04:00

Use u8 in Rounding, and introduce Roundingf (#5563)

* Part of https://github.com/emilk/egui/issues/4019

As part of the work on adding a custom `Border` to everything, I want to
make sure that the size of `RectShape`, `Frame` and the future `Border`
is kept small (for performance reasons).

This PR changes the storage of the corner radius of rectangles from four
`f32` (one for each corner) into four `u8`. This mean the corner radius
can only be an integer in the range 0-255 (in ui points). This should be
enough for most people.

If you want to manipulate rounding using `f32`, there is a new
`Roundingf` to fill that niche.
This commit is contained in:
Emil Ernerfeldt
2025-01-02 14:29:50 +01:00
committed by GitHub
parent 3ffe1ed774
commit 249f8bcb93
13 changed files with 508 additions and 242 deletions

View File

@@ -47,7 +47,7 @@ impl Shadow {
} = *self;
let rect = rect.translate(offset).expand(spread);
let rounding = rounding.into() + Rounding::same(spread.abs());
let rounding = rounding.into() + Rounding::from(spread.abs());
RectShape::filled(rect, rounding, color).with_blur_width(blur)
}