mirror of
https://gitlab.com/marcandre.lureau/qemu-display.git
synced 2024-06-03 03:13:58 +00:00
0a68e1e08d
- use pixman-sys - reuse self.update() for scanout - save a RDP DesktopSize for future resize usage - add some tracing Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
47 lines
1.1 KiB
Rust
47 lines
1.1 KiB
Rust
use ironrdp::server::PixelFormat;
|
|
|
|
#[macro_export]
|
|
macro_rules! cast {
|
|
($value:expr) => {
|
|
match $value.try_into() {
|
|
Ok(val) => val,
|
|
Err(err) => {
|
|
eprintln!("Error casting value: {}", err);
|
|
return;
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
pub(crate) struct PixmanFormat(pub u32);
|
|
|
|
#[cfg(target_endian = "little")]
|
|
impl TryFrom<PixmanFormat> for PixelFormat {
|
|
type Error = ();
|
|
|
|
fn try_from(value: PixmanFormat) -> Result<Self, Self::Error> {
|
|
use pixman_sys::*;
|
|
|
|
#[allow(non_upper_case_globals)]
|
|
match value.0 {
|
|
pixman_format_code_t_PIXMAN_x8r8g8b8 => Ok(PixelFormat::BgrX32),
|
|
_ => Err(()),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(target_endian = "big")]
|
|
impl TryFrom<PixmanFormat> for PixelFormat {
|
|
type Error = ();
|
|
|
|
fn try_from(value: PixmanFormat) -> Result<Self, Self::Error> {
|
|
use pixman_sys::*;
|
|
|
|
#[allow(non_upper_case_globals)]
|
|
match value.0 {
|
|
pixman_format_code_t_PIXMAN_x8r8g8b8 => Ok(PixelFormat::XRgb32),
|
|
_ => Err(()),
|
|
}
|
|
}
|
|
}
|