Skip to content

Commit

Permalink
chore: not resize when is not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Feb 16, 2024
1 parent 0ceaf38 commit 844f645
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions libwayshot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,19 @@ impl WayshotConnection {

let file = tempfile::tempfile().unwrap();
let image: DynamicImage = frame_copy.try_into()?;
let image = image::imageops::resize(
&image,
output_info.region.size.width,
output_info.region.size.height,
image::imageops::FilterType::Nearest,
);
let image = {
if output_info.region.size != frame_copy.frame_format.size {
image::imageops::resize(
&image,
output_info.region.size.width,
output_info.region.size.height,
image::imageops::FilterType::Triangle,
)
} else {
image.into_rgba8()
}
};

init_overlay(&image, &file);
let pool = shm.create_pool(
file.as_fd(),
Expand Down

0 comments on commit 844f645

Please sign in to comment.