Skip to content

Commit

Permalink
Add profiling scopes to app icon stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed May 22, 2023
1 parent e6db797 commit 4582699
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/eframe/src/epi/icon_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ impl IconData {
/// # Errors
/// If this is not a valid png.
pub fn try_from_png_bytes(png_bytes: &[u8]) -> Result<Self, image::ImageError> {
crate::profile_function!();
let image = image::load_from_memory(png_bytes)?;
Ok(Self::from_image(image))
}
Expand All @@ -38,6 +39,7 @@ impl IconData {
/// # Errors
/// If `width*height != 4 * rgba.len()`, or if the image is too big.
pub fn to_image(&self) -> Result<image::RgbaImage, String> {
crate::profile_function!();
let Self {
rgba,
width,
Expand All @@ -51,6 +53,7 @@ impl IconData {
/// # Errors
/// The image is invalid, or the PNG encoder failed.
pub fn to_png_bytes(&self) -> Result<Vec<u8>, String> {
crate::profile_function!();
let image = self.to_image()?;
let mut png_bytes: Vec<u8> = Vec::new();
image
Expand Down

0 comments on commit 4582699

Please sign in to comment.