diff --git a/crates/ironrdp-bench/benches/bench.rs b/crates/ironrdp-bench/benches/bench.rs index 8fabf29e..1d8a3830 100644 --- a/crates/ironrdp-bench/benches/bench.rs +++ b/crates/ironrdp-bench/benches/bench.rs @@ -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, diff --git a/crates/ironrdp-server/src/display.rs b/crates/ironrdp-server/src/display.rs index 22d502a6..e70e4e19 100644 --- a/crates/ironrdp-server/src/display.rs +++ b/crates/ironrdp-server/src/display.rs @@ -68,8 +68,8 @@ impl TryInto for BitmapUpdate { type Error = &'static str; fn try_into(self) -> Result { - 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 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) diff --git a/crates/ironrdp-server/src/encoder/bitmap.rs b/crates/ironrdp-server/src/encoder/bitmap.rs index 1476f29c..71a1ec17 100644 --- a/crates/ironrdp-server/src/encoder/bitmap.rs +++ b/crates/ironrdp-server/src/encoder/bitmap.rs @@ -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), diff --git a/crates/ironrdp-server/src/encoder/mod.rs b/crates/ironrdp-server/src/encoder/mod.rs index 6ac4079e..0aa675f9 100644 --- a/crates/ironrdp-server/src/encoder/mod.rs +++ b/crates/ironrdp-server/src/encoder/mod.rs @@ -158,10 +158,10 @@ impl UpdateEncoder { fn set_surface(&mut self, bitmap: BitmapUpdate, codec_id: u8, data: &[u8]) -> Result> { 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, diff --git a/crates/ironrdp/examples/server.rs b/crates/ironrdp/examples/server.rs index 30729686..873158b5 100644 --- a/crates/ironrdp/examples/server.rs +++ b/crates/ironrdp/examples/server.rs @@ -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,