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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user