mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +11:00
choose_pixel_format now returns a Result
This commit is contained in:
parent
d7c44b95b0
commit
697d42a64f
|
@ -304,7 +304,7 @@ impl<'a> BuilderAttribs<'a> {
|
||||||
(new_attribs, sharing)
|
(new_attribs, sharing)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn choose_pixel_format<T, I>(&self, iter: I) -> (T, PixelFormat)
|
fn choose_pixel_format<T, I>(&self, iter: I) -> Result<(T, PixelFormat), CreationError>
|
||||||
where I: Iterator<Item=(T, PixelFormat)>, T: Clone
|
where I: Iterator<Item=(T, PixelFormat)>, T: Clone
|
||||||
{
|
{
|
||||||
let mut current_result = None;
|
let mut current_result = None;
|
||||||
|
@ -343,7 +343,7 @@ impl<'a> BuilderAttribs<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
current_result.or(current_software_result)
|
current_result.or(current_software_result)
|
||||||
.expect("Could not find compliant pixel format")
|
.ok_or(CreationError::NotSupported)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>,
|
||||||
// getting the pixel format that we will use and setting it
|
// getting the pixel format that we will use and setting it
|
||||||
{
|
{
|
||||||
let formats = enumerate_native_pixel_formats(&dummy_window);
|
let formats = enumerate_native_pixel_formats(&dummy_window);
|
||||||
let (id, _) = builder.choose_pixel_format(formats.into_iter().map(|(a, b)| (b, a)));
|
let (id, _) = try!(builder.choose_pixel_format(formats.into_iter().map(|(a, b)| (b, a))));
|
||||||
try!(set_pixel_format(&dummy_window, id));
|
try!(set_pixel_format(&dummy_window, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>,
|
||||||
enumerate_native_pixel_formats(&real_window)
|
enumerate_native_pixel_formats(&real_window)
|
||||||
};
|
};
|
||||||
|
|
||||||
let (id, _) = builder.choose_pixel_format(formats.into_iter().map(|(a, b)| (b, a)));
|
let (id, _) = try!(builder.choose_pixel_format(formats.into_iter().map(|(a, b)| (b, a))));
|
||||||
try!(set_pixel_format(&real_window, id));
|
try!(set_pixel_format(&real_window, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue