Remove warm-up of demo app

Since https://github.com/emilk/egui/pull/1149 we only update the
region of the font atlas that has changes, so loading new glyphs is much
cheaper. This means warm-up is much less needed.

There is now a small delay when opening the font book,
but not when opening anything else.
This commit is contained in:
Emil Ernerfeldt 2022-01-25 01:08:10 +01:00
parent 7ed0880b8f
commit 1e4d8ae943
2 changed files with 12 additions and 16 deletions

View file

@ -67,11 +67,6 @@ impl epi::App for WrapApp {
egui::Rgba::TRANSPARENT // we set a `CentralPanel` fill color in `demo_windows.rs`
}
fn warm_up_enabled(&self) -> bool {
// The example windows use a lot of emojis. Pre-cache them by running one frame where everything is open
cfg!(not(debug_assertions))
}
fn update(&mut self, ctx: &egui::Context, frame: &epi::Frame) {
if let Some(web_info) = frame.info().web_info.as_ref() {
if let Some(anchor) = web_info.web_location_hash.strip_prefix('#') {

View file

@ -120,17 +120,6 @@ pub trait App {
/// Also allows you to restore state, if there is a storage (required the "persistence" feature).
fn setup(&mut self, _ctx: &egui::Context, _frame: &Frame, _storage: Option<&dyn Storage>) {}
/// If `true` a warm-up call to [`Self::update`] will be issued where
/// `ctx.memory().everything_is_visible()` will be set to `true`.
///
/// This will help pre-caching all text, preventing stutter when
/// opening a window containing new glyphs.
///
/// In this warm-up call, all painted shapes will be ignored.
fn warm_up_enabled(&self) -> bool {
false
}
/// Called on shutdown, and perhaps at regular intervals. Allows you to save state.
///
/// Only called when the "persistence" feature is enabled.
@ -203,6 +192,18 @@ pub trait App {
fn persist_egui_memory(&self) -> bool {
true
}
/// If `true` a warm-up call to [`Self::update`] will be issued where
/// `ctx.memory().everything_is_visible()` will be set to `true`.
///
/// This can help pre-caching resources loaded by different parts of the UI, preventing stutter later on.
///
/// In this warm-up call, all painted shapes will be ignored.
///
/// The default is `false`, and it is unlikely you will want to change this.
fn warm_up_enabled(&self) -> bool {
false
}
}
/// Options controlling the behavior of a native window.