perf: refactor to reduce memory allocations and cpu work
This commit is contained in:
parent
0c3e3c8629
commit
dd0158d8f0
24 changed files with 234 additions and 242 deletions
|
|
@ -237,7 +237,7 @@ impl<T: AsFd> ShmImage<T> {
|
|||
pub fn image(&self) -> anyhow::Result<image::RgbaImage> {
|
||||
let mmap = unsafe { memmap2::Mmap::map(&self.fd.as_fd())? };
|
||||
image::RgbaImage::from_raw(self.width, self.height, mmap.to_vec())
|
||||
.ok_or(anyhow::anyhow!("ShmImage had incorrect size"))
|
||||
.ok_or_else(|| anyhow::anyhow!("ShmImage had incorrect size"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -475,12 +475,12 @@ pub(crate) fn wayland_handler(
|
|||
exit: false,
|
||||
tx,
|
||||
conn,
|
||||
queue_handle: qh.clone(),
|
||||
shm_state,
|
||||
screencopy_state,
|
||||
seat_state: SeatState::new(&globals, &qh),
|
||||
toplevel_info_state: ToplevelInfoState::new(®istry_state, &qh),
|
||||
toplevel_manager_state: ToplevelManagerState::new(®istry_state, &qh),
|
||||
queue_handle: qh,
|
||||
registry_state,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue