mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-26 14:49:07 -04:00
icon: refactor Icon to be dyn
Same as for `CustomCursor`. However, the API uses `dyn` stuff only because of `Windows` backend at the time of writing, generally, platforms should just have a separate method that deals with all of that, and e.g. top-level winit only guarantees `Rgba`.
This commit is contained in:
@@ -20,6 +20,7 @@ use winit::dpi::{LogicalSize, PhysicalPosition, PhysicalSize};
|
||||
use winit::error::RequestError;
|
||||
use winit::event::{DeviceEvent, DeviceId, Ime, MouseButton, MouseScrollDelta, WindowEvent};
|
||||
use winit::event_loop::{ActiveEventLoop, EventLoop};
|
||||
use winit::icon::RgbaIcon;
|
||||
use winit::keyboard::{Key, ModifiersState};
|
||||
use winit::monitor::Fullscreen;
|
||||
#[cfg(macos_platform)]
|
||||
@@ -1156,7 +1157,7 @@ fn load_icon(bytes: &[u8]) -> Icon {
|
||||
let rgba = image.into_raw();
|
||||
(rgba, width, height)
|
||||
};
|
||||
Icon::from_rgba(icon_rgba, icon_width, icon_height).expect("Failed to open icon")
|
||||
RgbaIcon::new(icon_rgba, icon_width, icon_height).expect("Failed to open icon").into()
|
||||
}
|
||||
|
||||
fn modifiers_to_string(mods: ModifiersState) -> String {
|
||||
|
||||
Reference in New Issue
Block a user