From 4b0cdceab5c2dfc25df413f4c0ca5f9ccc500281 Mon Sep 17 00:00:00 2001 From: Comeza Date: Sat, 13 Mar 2021 19:47:38 +0100 Subject: [PATCH] improved performance --- src/img.rs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/img.rs b/src/img.rs index 51ce8b3..7ad312e 100644 --- a/src/img.rs +++ b/src/img.rs @@ -22,26 +22,20 @@ pub fn process_images( match direction { WriteDirection::Y => { - 'outer_y: for x in 0..(buffer_dim_x / img_dim_x) { + for x in 0..(buffer_dim_x / img_dim_x) { for y in 0..(buffer_dim_y / img_dim_y) { - let has_processed = overlay_image(index, files, image_buffer, &img_dim, x, y); + overlay_image(index, files, image_buffer, &img_dim, x, y); index += 1; progress_bar.inc(1); - if !has_processed { - break 'outer_y; - } } } } WriteDirection::X => { - 'outer_x: for y in 0..(buffer_dim_y / img_dim_y) { + for y in 0..(buffer_dim_y / img_dim_y) { for x in 0..(buffer_dim_x / img_dim_x) { - let has_processed = overlay_image(index, files, image_buffer, &img_dim, x, y); + overlay_image(index, files, image_buffer, &img_dim, x, y); index += 1; progress_bar.inc(1); - if !has_processed { - break 'outer_x; - } } } } @@ -56,7 +50,7 @@ fn overlay_image( img_dim: &Dimensions, x: u32, y: u32, -) -> bool { +) { match files.get(index) { Some(path) => { imageops::overlay( @@ -65,9 +59,8 @@ fn overlay_image( x * img_dim.x, y * img_dim.y, ); - true } - None => false, + None => (), } }