From 36de5a5e5a058602bcd98d9387f0f170a0fc55d4 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 30 Apr 2015 16:15:37 +0200 Subject: Fix PixelFormat for x11, egl and win32 --- src/api/egl/mod.rs | 6 +++--- src/api/win32/init.rs | 10 ++++------ src/api/x11/mod.rs | 6 +++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/api/egl/mod.rs b/src/api/egl/mod.rs index 18e731c..9c8db62 100644 --- a/src/api/egl/mod.rs +++ b/src/api/egl/mod.rs @@ -298,9 +298,9 @@ unsafe fn enumerate_configs(egl: &ffi::egl::Egl, display: ffi::egl::types::EGLDi result.push((config_id, PixelFormat { hardware_accelerated: attrib!(egl, display, config_id, ffi::egl::CONFIG_CAVEAT) != ffi::egl::SLOW_CONFIG as i32, - red_bits: attrib!(egl, display, config_id, ffi::egl::RED_SIZE) as u8, - green_bits: attrib!(egl, display, config_id, ffi::egl::BLUE_SIZE) as u8, - blue_bits: attrib!(egl, display, config_id, ffi::egl::GREEN_SIZE) as u8, + color_bits: attrib!(egl, display, config_id, ffi::egl::RED_SIZE) as u8 + + attrib!(egl, display, config_id, ffi::egl::BLUE_SIZE) as u8 + + attrib!(egl, display, config_id, ffi::egl::GREEN_SIZE) as u8, alpha_bits: attrib!(egl, display, config_id, ffi::egl::ALPHA_SIZE) as u8, depth_bits: attrib!(egl, display, config_id, ffi::egl::DEPTH_SIZE) as u8, stencil_bits: attrib!(egl, display, config_id, ffi::egl::STENCIL_SIZE) as u8, diff --git a/src/api/win32/init.rs b/src/api/win32/init.rs index a9d77d1..39b9d97 100644 --- a/src/api/win32/init.rs +++ b/src/api/win32/init.rs @@ -438,9 +438,7 @@ unsafe fn enumerate_native_pixel_formats(hdc: &WindowWrapper) -> Vec<(PixelForma result.push((PixelFormat { hardware_accelerated: (output.dwFlags & winapi::PFD_GENERIC_FORMAT) == 0, - red_bits: output.cRedBits, - green_bits: output.cGreenBits, - blue_bits: output.cBlueBits, + color_bits: output.cRedBits + output.cGreenBits + output.cBlueBits, alpha_bits: output.cAlphaBits, depth_bits: output.cDepthBits, stencil_bits: output.cStencilBits, @@ -489,9 +487,9 @@ unsafe fn enumerate_arb_pixel_formats(extra: &gl::wgl_extra::Wgl, hdc: &WindowWr result.push((PixelFormat { hardware_accelerated: true, - red_bits: get_info(index, gl::wgl_extra::RED_BITS_ARB) as u8, - green_bits: get_info(index, gl::wgl_extra::GREEN_BITS_ARB) as u8, - blue_bits: get_info(index, gl::wgl_extra::BLUE_BITS_ARB) as u8, + color_bits: get_info(index, gl::wgl_extra::RED_BITS_ARB) as u8 + + get_info(index, gl::wgl_extra::GREEN_BITS_ARB) as u8 + + get_info(index, gl::wgl_extra::BLUE_BITS_ARB) as u8, alpha_bits: get_info(index, gl::wgl_extra::ALPHA_BITS_ARB) as u8, depth_bits: get_info(index, gl::wgl_extra::DEPTH_BITS_ARB) as u8, stencil_bits: get_info(index, gl::wgl_extra::STENCIL_BITS_ARB) as u8, diff --git a/src/api/x11/mod.rs b/src/api/x11/mod.rs index 3dd90d3..6b528ab 100644 --- a/src/api/x11/mod.rs +++ b/src/api/x11/mod.rs @@ -411,9 +411,9 @@ impl Window { PixelFormat { hardware_accelerated: true, - red_bits: get_attrib(ffi::glx::RED_SIZE as libc::c_int) as u8, - green_bits: get_attrib(ffi::glx::GREEN_SIZE as libc::c_int) as u8, - blue_bits: get_attrib(ffi::glx::BLUE_SIZE as libc::c_int) as u8, + color_bits: get_attrib(ffi::glx::RED_SIZE as libc::c_int) as u8 + + get_attrib(ffi::glx::GREEN_SIZE as libc::c_int) as u8 + + get_attrib(ffi::glx::BLUE_SIZE as libc::c_int) as u8, alpha_bits: get_attrib(ffi::glx::ALPHA_SIZE as libc::c_int) as u8, depth_bits: get_attrib(ffi::glx::DEPTH_SIZE as libc::c_int) as u8, stencil_bits: get_attrib(ffi::glx::STENCIL_SIZE as libc::c_int) as u8, -- cgit v1.2.3