refactor(server)!: rename left/top -> x/y

This is more idiomatic, and thus less confusing.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2025-02-25 23:40:13 +04:00 committed by Benoît Cortier
parent 1e87961d16
commit 229070a435
5 changed files with 24 additions and 24 deletions

View file

@ -10,8 +10,8 @@ pub fn rfx_enc_tile_bench(c: &mut Criterion) {
let quant = rfx::Quant::default();
let algo = rfx::EntropyAlgorithm::Rlgr3;
let bitmap = BitmapUpdate {
top: 0,
left: 0,
x: 0,
y: 0,
width: NonZero::new(64).unwrap(),
height: NonZero::new(64).unwrap(),
format: ironrdp_server::PixelFormat::ARgb32,
@ -25,8 +25,8 @@ pub fn rfx_enc_bench(c: &mut Criterion) {
let quant = rfx::Quant::default();
let algo = rfx::EntropyAlgorithm::Rlgr3;
let bitmap = BitmapUpdate {
top: 0,
left: 0,
x: 0,
y: 0,
width: NonZero::new(2048).unwrap(),
height: NonZero::new(2048).unwrap(),
format: ironrdp_server::PixelFormat::ARgb32,

View file

@ -68,8 +68,8 @@ 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);
assert_eq!(self.x, 0);
assert_eq!(self.y, 0);
Ok(Framebuffer {
width: self.width,
height: self.height,
@ -87,8 +87,8 @@ impl TryInto<Framebuffer> for BitmapUpdate {
///
#[derive(Clone)]
pub struct BitmapUpdate {
pub top: u16,
pub left: u16,
pub x: u16,
pub y: u16,
pub width: NonZeroU16,
pub height: NonZeroU16,
pub format: PixelFormat,
@ -99,8 +99,8 @@ pub struct BitmapUpdate {
impl core::fmt::Debug for BitmapUpdate {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("BitmapUpdate")
.field("top", &self.top)
.field("left", &self.left)
.field("x", &self.x)
.field("y", &self.y)
.field("width", &self.width)
.field("height", &self.height)
.field("format", &self.format)

View file

@ -39,7 +39,7 @@ impl BitmapEncoder {
for (i, chunk) in chunks.enumerate() {
let height = chunk.len() / bitmap.stride;
let top = usize::from(bitmap.top) + i * chunk_height;
let top = usize::from(bitmap.y) + i * chunk_height;
let encoder = BitmapStreamEncoder::new(usize::from(bitmap.width.get()), height);
@ -55,9 +55,9 @@ impl BitmapEncoder {
let data = BitmapData {
rectangle: InclusiveRectangle {
left: bitmap.left,
left: bitmap.x,
top: u16::try_from(top).unwrap(),
right: bitmap.left + bitmap.width.get() - 1,
right: bitmap.x + bitmap.width.get() - 1,
bottom: u16::try_from(top + height - 1).unwrap(),
},
width: u16::from(bitmap.width),

View file

@ -158,10 +158,10 @@ impl UpdateEncoder {
fn set_surface(&mut self, bitmap: BitmapUpdate, codec_id: u8, data: &[u8]) -> Result<UpdateFragmenter<'_>> {
let destination = ExclusiveRectangle {
left: bitmap.left,
top: bitmap.top,
right: bitmap.left + bitmap.width.get(),
bottom: bitmap.top + bitmap.height.get(),
left: bitmap.x,
top: bitmap.y,
right: bitmap.x + bitmap.width.get(),
bottom: bitmap.y + bitmap.height.get(),
};
let extended_bitmap_data = ExtendedBitmapDataPdu {
bpp: bitmap.format.bytes_per_pixel() * 8,

View file

@ -159,10 +159,10 @@ impl RdpServerDisplayUpdates for DisplayUpdates {
sleep(Duration::from_millis(100)).await;
let mut rng = thread_rng();
let top: u16 = rng.gen_range(0..HEIGHT);
let height = NonZeroU16::new(rng.gen_range(1..=HEIGHT.checked_sub(top).unwrap())).unwrap();
let left: u16 = rng.gen_range(0..WIDTH);
let width = NonZeroU16::new(rng.gen_range(1..=WIDTH.checked_sub(left).unwrap())).unwrap();
let y: u16 = rng.gen_range(0..HEIGHT);
let height = NonZeroU16::new(rng.gen_range(1..=HEIGHT.checked_sub(y).unwrap())).unwrap();
let x: u16 = rng.gen_range(0..WIDTH);
let width = NonZeroU16::new(rng.gen_range(1..=WIDTH.checked_sub(x).unwrap())).unwrap();
let capacity = usize::from(width.get())
.checked_mul(usize::from(height.get()))
.unwrap()
@ -176,10 +176,10 @@ impl RdpServerDisplayUpdates for DisplayUpdates {
data.push(255);
}
info!("get_update +{left}+{top} {width}x{height}");
info!("get_update +{x}+{y} {width}x{height}");
let bitmap = BitmapUpdate {
top,
left,
x,
y,
width,
height,
format: PixelFormat::BgrA32,