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

Add more puffin profile scopes to eframe (#3330)

* Add puffin profile scopes to the startup and running of eframe

* puffin_profiler example: start puffin right away

* cargo format let-else statements

* More profile scopes

* Add some `#[inline]`

* Standardize puffin profile scope definitions

* standardize again

* Silence warning when puffin is disabled
This commit is contained in:
Emil Ernerfeldt
2023-09-13 09:00:38 +02:00
committed by GitHub
parent 2bc6814acc
commit fc3bddd0cf
17 changed files with 414 additions and 255 deletions

View File

@@ -143,7 +143,9 @@ impl eframe::App for ImageViewer {
if !matches!(self.fit, ImageFit::Exact(_)) {
self.fit = ImageFit::Exact(Vec2::splat(128.0));
}
let ImageFit::Exact(size) = &mut self.fit else { unreachable!() };
let ImageFit::Exact(size) = &mut self.fit else {
unreachable!()
};
ui.add(Slider::new(&mut size.x, 0.0..=2048.0).text("width"));
ui.add(Slider::new(&mut size.y, 0.0..=2048.0).text("height"));
}
@@ -151,7 +153,9 @@ impl eframe::App for ImageViewer {
if !matches!(self.fit, ImageFit::Fraction(_)) {
self.fit = ImageFit::Fraction(Vec2::splat(1.0));
}
let ImageFit::Fraction(fract) = &mut self.fit else { unreachable!() };
let ImageFit::Fraction(fract) = &mut self.fit else {
unreachable!()
};
ui.add(Slider::new(&mut fract.x, 0.0..=1.0).text("width"));
ui.add(Slider::new(&mut fract.y, 0.0..=1.0).text("height"));
}
@@ -159,7 +163,9 @@ impl eframe::App for ImageViewer {
if !matches!(self.fit, ImageFit::Original(_)) {
self.fit = ImageFit::Original(Some(1.0));
}
let ImageFit::Original(Some(scale)) = &mut self.fit else { unreachable!() };
let ImageFit::Original(Some(scale)) = &mut self.fit else {
unreachable!()
};
ui.add(Slider::new(scale, 0.1..=4.0).text("scale"));
}
}