mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 22:30:03 -04:00
Add opt-in puffin feature to egui-extras (#3307)
* Add opt-in `puffin` feature to `egui-extras` Image loading can be slow. Related to https://github.com/emilk/egui/pull/3297 * Silence warning
This commit is contained in:
@@ -203,6 +203,7 @@ use egui::ColorImage;
|
||||
/// On invalid image or unsupported image format.
|
||||
#[cfg(feature = "image")]
|
||||
pub fn load_image_bytes(image_bytes: &[u8]) -> Result<egui::ColorImage, String> {
|
||||
crate::profile_function!();
|
||||
let image = image::load_from_memory(image_bytes).map_err(|err| err.to_string())?;
|
||||
let size = [image.width() as _, image.height() as _];
|
||||
let image_buffer = image.to_rgba8();
|
||||
@@ -235,6 +236,7 @@ pub fn load_svg_bytes_with_size(
|
||||
svg_bytes: &[u8],
|
||||
fit_to: FitTo,
|
||||
) -> Result<egui::ColorImage, String> {
|
||||
crate::profile_function!();
|
||||
let opt = usvg::Options::default();
|
||||
|
||||
let rtree = usvg::Tree::from_data(svg_bytes, &opt).map_err(|err| err.to_string())?;
|
||||
|
||||
Reference in New Issue
Block a user