Skip to content

Commit

Permalink
Remove deprecated image::into_reader() (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
PolyMeilex authored Jan 14, 2024
1 parent 16069e9 commit 319d195
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions neothesia/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,18 +317,16 @@ fn set_window_icon(window: &winit::window::Window) -> Result<(), Box<dyn std::er
use iced_graphics::image::image_rs;
use image_rs::codecs::png::PngDecoder;
use image_rs::ImageDecoder;
use std::io::{Cursor, Read};
use std::io::Cursor;

let icon = PngDecoder::new(Cursor::new(include_bytes!(
"../../flatpak/com.github.polymeilex.neothesia.png"
)))?;

let (w, h) = icon.dimensions();

let mut icon = icon.into_reader()?;

let mut buff = Vec::new();
icon.read_to_end(&mut buff)?;
let mut buff = vec![0; icon.total_bytes() as usize];
icon.read_image(&mut buff)?;

window.set_window_icon(Some(winit::window::Icon::from_rgba(buff, w, h)?));

Expand Down

0 comments on commit 319d195

Please sign in to comment.