diff options
author | tomaka <pierre.krieger1708@gmail.com> | 2015-03-01 12:01:20 +0100 |
---|---|---|
committer | tomaka <pierre.krieger1708@gmail.com> | 2015-03-01 12:01:20 +0100 |
commit | af4662d84c68b9bb21b9b05d61a9b55f31ae88df (patch) | |
tree | a34eae9c42ce0f7eff918e3fe90c37a21826b66d /src/lib.rs | |
parent | 77d8a113385e8bb85f145d514724a1e3bd574cfd (diff) | |
parent | 42d38e66ab51c1095d65683494dfabf80552bf92 (diff) | |
download | glutin-af4662d84c68b9bb21b9b05d61a9b55f31ae88df.tar.gz glutin-af4662d84c68b9bb21b9b05d61a9b55f31ae88df.zip |
Merge pull request #301 from tomaka/win32
Use the WGL API to determine extended pixel format, plus fix creation
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -195,7 +195,9 @@ pub enum MouseCursor { /// Describes a possible format. Unused. #[allow(missing_docs)] +#[derive(Debug, Clone)] pub struct PixelFormat { + pub hardware_accelerated: bool, pub red_bits: u8, pub green_bits: u8, pub blue_bits: u8, @@ -282,6 +284,7 @@ impl<'a> BuilderAttribs<'a> { where I: Iterator<Item=(T, PixelFormat)>, T: Clone { let mut current_result = None; + let mut current_software_result = None; // TODO: do this more properly for (id, format) in iter { @@ -309,9 +312,13 @@ impl<'a> BuilderAttribs<'a> { continue; } - current_result = Some((id, format)); + current_software_result = Some((id.clone(), format.clone())); + if format.hardware_accelerated { + current_result = Some((id, format)); + } } - current_result.expect("Could not find compliant pixel format") + current_result.or(current_software_result) + .expect("Could not find compliant pixel format") } } |