mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
update to image 0.20 (#683)
This commit is contained in:
parent
062bb0cef2
commit
da1d479e55
|
@ -1,5 +1,6 @@
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- **Breaking:** `image` crate upgraded to 0.20. This is exposed as part of the `icon_loading` API.
|
||||||
- On Wayland, pointer events will now provide the current modifiers state.
|
- On Wayland, pointer events will now provide the current modifiers state.
|
||||||
- On Wayland, titles will now be displayed in the window header decoration.
|
- On Wayland, titles will now be displayed in the window header decoration.
|
||||||
- On Wayland, key repetition is now ended when keyboard loses focus.
|
- On Wayland, key repetition is now ended when keyboard loses focus.
|
||||||
|
|
|
@ -20,7 +20,7 @@ icon_loading = ["image"]
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
image = { version = "0.19", optional = true }
|
image = { version = "0.20", optional = true }
|
||||||
|
|
||||||
[target.'cfg(target_os = "android")'.dependencies.android_glue]
|
[target.'cfg(target_os = "android")'.dependencies.android_glue]
|
||||||
version = "0.2"
|
version = "0.2"
|
||||||
|
|
|
@ -6,10 +6,9 @@ extern crate winit;
|
||||||
#[cfg(feature = "icon_loading")]
|
#[cfg(feature = "icon_loading")]
|
||||||
extern crate image;
|
extern crate image;
|
||||||
|
|
||||||
use winit::Icon;
|
|
||||||
|
|
||||||
#[cfg(feature = "icon_loading")]
|
#[cfg(feature = "icon_loading")]
|
||||||
fn main() {
|
fn main() {
|
||||||
|
use winit::Icon;
|
||||||
// You'll have to choose an icon size at your own discretion. On X11, the desired size varies
|
// You'll have to choose an icon size at your own discretion. On X11, the desired size varies
|
||||||
// by WM, and on Windows, you still have to account for screen scaling. Here we use 32px,
|
// by WM, and on Windows, you still have to account for screen scaling. Here we use 32px,
|
||||||
// since it seems to work well enough in most cases. Be careful about going too high, or
|
// since it seems to work well enough in most cases. Be careful about going too high, or
|
||||||
|
@ -37,7 +36,7 @@ fn main() {
|
||||||
match event {
|
match event {
|
||||||
CloseRequested => return winit::ControlFlow::Break,
|
CloseRequested => return winit::ControlFlow::Break,
|
||||||
DroppedFile(path) => {
|
DroppedFile(path) => {
|
||||||
use image::GenericImage;
|
use image::GenericImageView;
|
||||||
|
|
||||||
let icon_image = image::open(path).expect("Failed to open window icon");
|
let icon_image = image::open(path).expect("Failed to open window icon");
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ impl Icon {
|
||||||
/// Requires the `icon_loading` feature.
|
/// Requires the `icon_loading` feature.
|
||||||
impl From<image::DynamicImage> for Icon {
|
impl From<image::DynamicImage> for Icon {
|
||||||
fn from(image: image::DynamicImage) -> Self {
|
fn from(image: image::DynamicImage) -> Self {
|
||||||
use image::{GenericImage, Pixel};
|
use image::{GenericImageView, Pixel};
|
||||||
let (width, height) = image.dimensions();
|
let (width, height) = image.dimensions();
|
||||||
let mut rgba = Vec::with_capacity((width * height) as usize * PIXEL_SIZE);
|
let mut rgba = Vec::with_capacity((width * height) as usize * PIXEL_SIZE);
|
||||||
for (_, _, pixel) in image.pixels() {
|
for (_, _, pixel) in image.pixels() {
|
||||||
|
|
Loading…
Reference in a new issue