diff --git a/src/assets.rs b/src/assets.rs index d5e2673..6cae6ba 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -14,6 +14,12 @@ pub struct HighlightingAssets { pub theme_set: ThemeSet, } +impl Default for HighlightingAssets { + fn default() -> Self { + Self::new() + } +} + impl HighlightingAssets { pub fn new() -> Self { Self::from_dump_file().unwrap_or_else(|_| Self { diff --git a/src/blur.rs b/src/blur.rs index 883309f..b9c011f 100644 --- a/src/blur.rs +++ b/src/blur.rs @@ -38,9 +38,9 @@ pub fn gaussian_blur(image: RgbaImage, sigma: f32) -> RgbaImage { RgbaImage::from_raw(width, height, raw).unwrap() } -fn gaussian_blur_impl(data: &mut Vec<[u8; 4]>, width: usize, height: usize, blur_radius: f32) { +fn gaussian_blur_impl(data: &mut [[u8; 4]], width: usize, height: usize, blur_radius: f32) { let bxs = create_box_gauss(blur_radius, 3); - let mut backbuf = data.clone(); + let mut backbuf = data.to_vec(); box_blur( &mut backbuf, @@ -103,8 +103,8 @@ fn create_box_gauss(sigma: f32, n: usize) -> Vec { /// Needs 2x the same image #[inline] fn box_blur( - backbuf: &mut Vec<[u8; 4]>, - frontbuf: &mut Vec<[u8; 4]>, + backbuf: &mut [[u8; 4]], + frontbuf: &mut [[u8; 4]], width: usize, height: usize, blur_radius: usize, diff --git a/src/utils.rs b/src/utils.rs index 8026027..7a27824 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -86,7 +86,7 @@ pub(crate) fn add_window_controls(image: &mut DynamicImage, params: &WindowContr let mut title_bar = RgbaImage::from_pixel(params.width * 3, params.height * 3, background); let step = (params.radius * 2) as i32; - let spacer = (step * 2) as i32; + let spacer = step * 2; let center_y = (params.height / 2) as i32; for (i, (fill, outline)) in color.iter().enumerate() {