mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-29 12:46:53 -06:00
Integration: font menu previews load through the GPU-limit-safe texture loader
#466 moves font_menu_body into font_menu.rs with its own preview cache, which calls egui's load_texture directly; next's #393 routes every texture through widgets::load_texture so one past the GPU's maximum side is scaled down instead of crashing.
This commit is contained in:
@@ -232,7 +232,7 @@ fn preview(
|
||||
}
|
||||
let img = designcraft_render::glyphs::text_line(fonts, family, style, text, px, color.to_array());
|
||||
let ci = egui::ColorImage::from_rgba_premultiplied([img.width as usize, img.height as usize], &img.pixels);
|
||||
let t = ui.ctx().load_texture(format!("font_preview_{family}_{style}"), ci, egui::TextureOptions::LINEAR);
|
||||
let t = crate::widgets::load_texture(ui.ctx(), format!("font_preview_{family}_{style}"), ci, egui::TextureOptions::LINEAR);
|
||||
ui.data_mut(|d| d.get_temp_mut_or_default::<Previews>(cache_id).insert(key, t.clone()));
|
||||
t
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user