1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 14:49:06 -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

@@ -92,10 +92,10 @@ impl Keypad {
ui.vertical(|ui| {
let window_margin = ui.spacing().window_margin;
let size_1x1 = vec2(32.0, 26.0);
let _size_1x2 = vec2(32.0, 52.0 + window_margin.top);
let _size_2x1 = vec2(64.0 + window_margin.left, 26.0);
let _size_1x2 = vec2(32.0, 52.0 + window_margin.topf());
let _size_2x1 = vec2(64.0 + window_margin.leftf(), 26.0);
ui.spacing_mut().item_spacing = Vec2::splat(window_margin.left);
ui.spacing_mut().item_spacing = Vec2::splat(window_margin.leftf());
ui.horizontal(|ui| {
if ui.add_sized(size_1x1, Button::new("1")).clicked() {