Skip to content

Commit 3c43fdd

Browse files
elmarcoCBenoit
authored andcommitted
refactor(server)!: use bytes, allowing shareable bitmap data
Signed-off-by: Marc-André Lureau <[email protected]>
1 parent 7f57817 commit 3c43fdd

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ironrdp-bench/benches/bench.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn rfx_enc_tile_bench(c: &mut Criterion) {
1515
width: NonZero::new(64).unwrap(),
1616
height: NonZero::new(64).unwrap(),
1717
format: ironrdp_server::PixelFormat::ARgb32,
18-
data: vec![0; 64 * 64 * 4],
18+
data: vec![0; 64 * 64 * 4].into(),
1919
stride: 64 * 4,
2020
};
2121
c.bench_function("rfx_enc_tile", |b| b.iter(|| rfx_enc_tile(&bitmap, &quant, algo, 0, 0)));
@@ -30,7 +30,7 @@ pub fn rfx_enc_bench(c: &mut Criterion) {
3030
width: NonZero::new(2048).unwrap(),
3131
height: NonZero::new(2048).unwrap(),
3232
format: ironrdp_server::PixelFormat::ARgb32,
33-
data: vec![0; 2048 * 2048 * 4],
33+
data: vec![0; 2048 * 2048 * 4].into(),
3434
stride: 64 * 4,
3535
};
3636
c.bench_function("rfx_enc", |b| b.iter(|| rfx_enc(&bitmap, &quant, algo)));

crates/ironrdp-server/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ tracing = { version = "0.1", features = ["log"] }
4545
x509-cert = { version = "0.2.5", optional = true }
4646
rustls-pemfile = { version = "2.2.0", optional = true }
4747
rayon = { version = "1.10.0", optional = true }
48+
bytes = "1"
4849

4950
[dev-dependencies]
5051
tokio = { version = "1", features = ["sync"] }

crates/ironrdp-server/src/display.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use core::num::NonZeroU16;
22

33
use anyhow::Result;
4+
use bytes::Bytes;
45
use ironrdp_displaycontrol::pdu::DisplayControlMonitorLayout;
56
use ironrdp_pdu::pointer::PointerPositionAttribute;
67

@@ -67,7 +68,7 @@ pub struct BitmapUpdate {
6768
pub width: NonZeroU16,
6869
pub height: NonZeroU16,
6970
pub format: PixelFormat,
70-
pub data: Vec<u8>,
71+
pub data: Bytes,
7172
pub stride: usize,
7273
}
7374

crates/ironrdp/examples/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl RdpServerDisplayUpdates for DisplayUpdates {
183183
width,
184184
height,
185185
format: PixelFormat::BgrA32,
186-
data,
186+
data: data.into(),
187187
stride: usize::from(width.get()).checked_mul(4).unwrap(),
188188
};
189189
Some(DisplayUpdate::Bitmap(bitmap))

0 commit comments

Comments
 (0)