Add profiling scopes to app icon stuff
This commit is contained in:
parent
e6db7977f9
commit
45826999ac
|
|
@ -20,6 +20,7 @@ impl IconData {
|
||||||
/// # Errors
|
/// # Errors
|
||||||
/// If this is not a valid png.
|
/// If this is not a valid png.
|
||||||
pub fn try_from_png_bytes(png_bytes: &[u8]) -> Result<Self, image::ImageError> {
|
pub fn try_from_png_bytes(png_bytes: &[u8]) -> Result<Self, image::ImageError> {
|
||||||
|
crate::profile_function!();
|
||||||
let image = image::load_from_memory(png_bytes)?;
|
let image = image::load_from_memory(png_bytes)?;
|
||||||
Ok(Self::from_image(image))
|
Ok(Self::from_image(image))
|
||||||
}
|
}
|
||||||
|
|
@ -38,6 +39,7 @@ impl IconData {
|
||||||
/// # Errors
|
/// # Errors
|
||||||
/// If `width*height != 4 * rgba.len()`, or if the image is too big.
|
/// If `width*height != 4 * rgba.len()`, or if the image is too big.
|
||||||
pub fn to_image(&self) -> Result<image::RgbaImage, String> {
|
pub fn to_image(&self) -> Result<image::RgbaImage, String> {
|
||||||
|
crate::profile_function!();
|
||||||
let Self {
|
let Self {
|
||||||
rgba,
|
rgba,
|
||||||
width,
|
width,
|
||||||
|
|
@ -51,6 +53,7 @@ impl IconData {
|
||||||
/// # Errors
|
/// # Errors
|
||||||
/// The image is invalid, or the PNG encoder failed.
|
/// The image is invalid, or the PNG encoder failed.
|
||||||
pub fn to_png_bytes(&self) -> Result<Vec<u8>, String> {
|
pub fn to_png_bytes(&self) -> Result<Vec<u8>, String> {
|
||||||
|
crate::profile_function!();
|
||||||
let image = self.to_image()?;
|
let image = self.to_image()?;
|
||||||
let mut png_bytes: Vec<u8> = Vec::new();
|
let mut png_bytes: Vec<u8> = Vec::new();
|
||||||
image
|
image
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue