1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

Store Margin using i8 to reduce its size (#5567)

Adds `Marginf` to fill the previous niche.

This is all in a pursuit to shrink the sizes of often-used structs, to
improve performance (less cache misses, less memcpy:s, etc).

* On the path towards https://github.com/emilk/egui/issues/4019
This commit is contained in:
Emil Ernerfeldt
2025-01-02 16:05:52 +01:00
committed by GitHub
parent aeea70d9e7
commit d58d13781d
12 changed files with 449 additions and 107 deletions

View File

@@ -1,4 +1,4 @@
use super::{Color32, Margin, Rect, RectShape, Rounding, Vec2};
use crate::{Color32, Marginf, Rect, RectShape, Rounding, Vec2};
/// The color and fuzziness of a fuzzy shape.
///
@@ -53,14 +53,14 @@ impl Shadow {
}
/// How much larger than the parent rect are we in each direction?
pub fn margin(&self) -> Margin {
pub fn margin(&self) -> Marginf {
let Self {
offset,
blur,
spread,
color: _,
} = *self;
Margin {
Marginf {
left: spread + 0.5 * blur - offset.x,
right: spread + 0.5 * blur + offset.x,
top: spread + 0.5 * blur - offset.y,