1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

Remove some uses of top-level panels in our examples (#7729)

We're phasing out top-level panels (panels that use `Context` directly,
instead of being inside another `Ui`).
As a first step, stop using them in our demo library and application.

* Part of https://github.com/emilk/egui/issues/3524
This commit is contained in:
Emil Ernerfeldt
2025-11-21 20:22:01 +01:00
committed by GitHub
parent d53a4a9c1d
commit d5869bfeaf
13 changed files with 165 additions and 136 deletions

View File

@@ -29,7 +29,9 @@ pub fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("demo_with_tessellate__realistic", |b| {
b.iter(|| {
let full_output = ctx.run(RawInput::default(), |ctx| {
demo_windows.ui(ctx);
egui::CentralPanel::default().show(ctx, |ui| {
demo_windows.ui(ui);
});
});
ctx.tessellate(full_output.shapes, full_output.pixels_per_point)
});
@@ -38,13 +40,17 @@ pub fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("demo_no_tessellate", |b| {
b.iter(|| {
ctx.run(RawInput::default(), |ctx| {
demo_windows.ui(ctx);
egui::CentralPanel::default().show(ctx, |ui| {
demo_windows.ui(ui);
});
})
});
});
let full_output = ctx.run(RawInput::default(), |ctx| {
demo_windows.ui(ctx);
egui::CentralPanel::default().show(ctx, |ui| {
demo_windows.ui(ui);
});
});
c.bench_function("demo_only_tessellate", |b| {
b.iter(|| ctx.tessellate(full_output.shapes.clone(), full_output.pixels_per_point));
@@ -58,7 +64,9 @@ pub fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("demo_full_no_tessellate", |b| {
b.iter(|| {
ctx.run(RawInput::default(), |ctx| {
demo_windows.ui(ctx);
egui::CentralPanel::default().show(ctx, |ui| {
demo_windows.ui(ui);
});
})
});
});