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

Deprecate CentralPanel::show (#7783)

* Part of https://github.com/emilk/egui/issues/3524

Use `show_inside` instead, with a `Ui` instead of a `Context`
This commit is contained in:
Emil Ernerfeldt
2025-12-17 16:39:13 +01:00
committed by GitHub
parent 53ec7333c3
commit 6157a35985
5 changed files with 46 additions and 31 deletions

View File

@@ -140,19 +140,19 @@ pub fn criterion_benchmark(c: &mut Criterion) {
let ctx = egui::Context::default();
ctx.begin_pass(RawInput::default());
egui::CentralPanel::default().show(&ctx, |ui| {
c.bench_function("Painter::rect", |b| {
let painter = ui.painter();
let rect = ui.max_rect();
b.iter(|| {
painter.rect(
rect,
2.0,
egui::Color32::RED,
(1.0, egui::Color32::WHITE),
egui::StrokeKind::Inside,
);
});
let painter =
egui::Painter::new(ctx.clone(), egui::LayerId::background(), ctx.content_rect());
c.bench_function("Painter::rect", |b| {
let rect = painter.clip_rect();
b.iter(|| {
painter.rect(
rect,
2.0,
egui::Color32::RED,
(1.0, egui::Color32::WHITE),
egui::StrokeKind::Inside,
);
});
});