qemu-display/qemu-rdp/src/util.rs
Marc-André Lureau 0a68e1e08d qemu-rdp: some ConsoleListner improvements
- 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>
2024-04-10 14:03:08 +04:00

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(()),
}
}
}