feat(server): add Framebuffer helper struct

This will hold the updated bitmap data for the whole framebuffer.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2025-03-17 14:07:23 +04:00 committed by Benoît Cortier
parent 3c43fdda76
commit 1e87961d16

View file

@ -1,7 +1,7 @@
use core::num::NonZeroU16;
use anyhow::Result;
use bytes::Bytes;
use bytes::{Bytes, BytesMut};
use ironrdp_displaycontrol::pdu::DisplayControlMonitorLayout;
use ironrdp_pdu::pointer::PointerPositionAttribute;
@ -56,6 +56,30 @@ pub struct ColorPointer {
pub xor_mask: Vec<u8>,
}
pub struct Framebuffer {
pub width: NonZeroU16,
pub height: NonZeroU16,
pub format: PixelFormat,
pub data: BytesMut,
pub stride: usize,
}
impl TryInto<Framebuffer> for BitmapUpdate {
type Error = &'static str;
fn try_into(self) -> Result<Framebuffer, Self::Error> {
assert_eq!(self.top, 0);
assert_eq!(self.left, 0);
Ok(Framebuffer {
width: self.width,
height: self.height,
format: self.format,
data: self.data.try_into_mut().map_err(|_| "BitmapUpdate is shared")?,
stride: self.stride,
})
}
}
/// Bitmap Display Update
///
/// Bitmap updates are encoded using RDP 6.0 compression, fragmented and sent using