mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-26 22:53:15 -04:00
fix: Allow unknown bit-depth on macOS (#4190)
It is unclear what values CGDisplayModeCopyPixelEncoding is allowed to return, so let's make sure to handle unknown cases.
This commit is contained in:
@@ -151,6 +151,13 @@ impl VideoMode {
|
||||
/// Returns the bit depth of this video mode, as in how many bits you have
|
||||
/// available per color. This is generally 24 bits or 32 bits on modern
|
||||
/// systems, depending on whether the alpha channel is counted or not.
|
||||
///
|
||||
/// # Platform-specific
|
||||
///
|
||||
/// - **macOS**: Video modes do not control the bit depth of the monitor, so this often defaults
|
||||
/// to 32.
|
||||
/// - **iOS**: Always returns `None`.
|
||||
/// - **Wayland**: Always returns `None`.
|
||||
pub fn bit_depth(&self) -> Option<NonZeroU16> {
|
||||
self.bit_depth
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user