Skip to content

Commit

Permalink
One less clone()
Browse files Browse the repository at this point in the history
I thinki t was being optimized out regardless, but now it's explicit.
  • Loading branch information
Beinsezii committed Jun 15, 2024
1 parent 28fa76b commit 177ae63
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use std::ffi::{OsStr, OsString};
use std::fs::{read_to_string, remove_file, write, File};
use std::sync::{Arc, Mutex};
use std::{
collections::HashMap, env, io::Read, mem::swap, num::NonZeroUsize, os::unix::fs::PermissionsExt, path::PathBuf,
};
use std::{collections::HashMap, env, io::Read, num::NonZeroUsize, os::unix::fs::PermissionsExt, path::PathBuf};

use colcon::{convert_space, convert_space_chunked, Space};
use eframe::egui::style::{ScrollStyle, Selection, Spacing, WidgetVisuals, Widgets};
Expand Down Expand Up @@ -489,21 +487,18 @@ impl Linch {
if monochrome {
let mut pixels: Vec<[f32; 4]> = ci
.pixels
.clone()
.into_iter()
.map(|c32| Rgba::from(c32).to_rgba_unmultiplied())
.collect();

monochromatize(acc_pixel, &mut pixels, Space::LRGB);

let mut pixels: Vec<Color32> = pixels
ci.pixels = pixels
.into_iter()
.map(|p| {
Color32::from(Rgba::from_rgba_unmultiplied(p[0], p[1], p[2], p[3]))
})
.collect();

swap(&mut ci.pixels, &mut pixels);
}
let th = cc.egui_ctx.load_texture(icon, ci, TextureOptions::default());
images.insert(icon.to_string(), th);
Expand Down

0 comments on commit 177ae63

Please sign in to comment.