1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00: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

@@ -29,6 +29,8 @@ pub mod image;
mod margin;
mod mesh;
pub mod mutex;
mod rounding;
mod roundingf;
mod shadow;
mod shape;
pub mod shape_transform;
@@ -47,10 +49,12 @@ pub use self::{
image::{ColorImage, FontImage, ImageData, ImageDelta},
margin::Margin,
mesh::{Mesh, Mesh16, Vertex},
rounding::Rounding,
roundingf::Roundingf,
shadow::Shadow,
shape::{
CircleShape, EllipseShape, PaintCallback, PaintCallbackInfo, PathShape, RectShape,
Rounding, Shape, TextShape,
CircleShape, EllipseShape, PaintCallback, PaintCallbackInfo, PathShape, RectShape, Shape,
TextShape,
},
stats::PaintStats,
stroke::{PathStroke, Stroke, StrokeKind},