mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
Shape refactor (#705)
* More introspection stats about vertices/indices etc * more serde derive * #[inline] to Shape constructors * Introduce RectShape * Introduce CircleShape * Introduce PathShape * More serde derive * impl Copy for RectShape and CircleShape * Simplify some code * More serde derive * Add helpers for appending more input or output * Serde derives for RawInput * Rename Fonts::from_definitions to Fonts::new * Add Output::take * refactor EguiGlium slightly * Derive PartialEq for RawInput * Improve egui::util::History interface * tweaks * Improve History filter: add minimum length * Calculate galley bounding rect * tessellator: cull line segments and paths * tessellator: cull meshes * Fix bug in History bandwidth estimator
This commit is contained in:
@@ -65,7 +65,7 @@ pub fn drop_target<R>(
|
||||
|
||||
ui.painter().set(
|
||||
where_to_put_background,
|
||||
Shape::Rect {
|
||||
epaint::RectShape {
|
||||
corner_radius: style.corner_radius,
|
||||
fill,
|
||||
stroke,
|
||||
|
||||
@@ -6,9 +6,10 @@ pub struct FrameHistory {
|
||||
|
||||
impl Default for FrameHistory {
|
||||
fn default() -> Self {
|
||||
let max_age: f64 = 1.0;
|
||||
let max_age: f32 = 1.0;
|
||||
let max_len = (max_age * 300.0).round() as usize;
|
||||
Self {
|
||||
frame_times: History::from_max_len_age((max_age * 300.0).round() as usize, max_age),
|
||||
frame_times: History::new(0..max_len, max_age),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,12 +74,12 @@ impl FrameHistory {
|
||||
let to_screen = emath::RectTransform::from_to(graph_rect, rect);
|
||||
|
||||
let mut shapes = Vec::with_capacity(3 + 2 * history.len());
|
||||
shapes.push(Shape::Rect {
|
||||
shapes.push(Shape::Rect(epaint::RectShape {
|
||||
rect,
|
||||
corner_radius: style.corner_radius,
|
||||
fill: ui.visuals().extreme_bg_color,
|
||||
stroke: ui.style().noninteractive().bg_stroke,
|
||||
});
|
||||
}));
|
||||
|
||||
let rect = rect.shrink(4.0);
|
||||
let color = ui.visuals().text_color();
|
||||
|
||||
Reference in New Issue
Block a user