1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 13:52:55 +03:00

deps: fastrand -> 2.0

This commit is contained in:
Wez Furlong 2023-06-19 10:44:21 -07:00
parent 6b82c41a67
commit c1f495099e
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
3 changed files with 19 additions and 13 deletions

16
Cargo.lock generated
View File

@ -206,7 +206,7 @@ dependencies = [
"async-lock", "async-lock",
"async-task", "async-task",
"concurrent-queue", "concurrent-queue",
"fastrand", "fastrand 1.9.0",
"futures-lite", "futures-lite",
"slab", "slab",
] ]
@ -459,7 +459,7 @@ dependencies = [
"async-lock", "async-lock",
"async-task", "async-task",
"atomic-waker", "atomic-waker",
"fastrand", "fastrand 1.9.0",
"futures-lite", "futures-lite",
"log", "log",
] ]
@ -1537,6 +1537,12 @@ dependencies = [
"instant", "instant",
] ]
[[package]]
name = "fastrand"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764"
[[package]] [[package]]
name = "fdeflate" name = "fdeflate"
version = "0.3.0" version = "0.3.0"
@ -1752,7 +1758,7 @@ version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce"
dependencies = [ dependencies = [
"fastrand", "fastrand 1.9.0",
"futures-core", "futures-core",
"futures-io", "futures-io",
"memchr", "memchr",
@ -4914,7 +4920,7 @@ checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cfg-if", "cfg-if",
"fastrand", "fastrand 1.9.0",
"redox_syscall 0.3.5", "redox_syscall 0.3.5",
"rustix", "rustix",
"windows-sys 0.48.0", "windows-sys 0.48.0",
@ -5932,7 +5938,7 @@ dependencies = [
"env-bootstrap", "env-bootstrap",
"env_logger", "env_logger",
"euclid", "euclid",
"fastrand", "fastrand 2.0.0",
"filedescriptor", "filedescriptor",
"finl_unicode", "finl_unicode",
"frecency", "frecency",

View File

@ -47,7 +47,7 @@ dirs-next = "2.0"
emojis = "0.6" emojis = "0.6"
env-bootstrap = { path = "../env-bootstrap" } env-bootstrap = { path = "../env-bootstrap" }
euclid = "0.22" euclid = "0.22"
fastrand = "1.6" fastrand = "2.0"
filedescriptor = { version="0.8", path = "../filedescriptor" } filedescriptor = { version="0.8", path = "../filedescriptor" }
finl_unicode = "1.2" finl_unicode = "1.2"
frecency = { path = "../frecency" } frecency = { path = "../frecency" }

View File

@ -50,7 +50,7 @@ impl CachedGradient {
let (dmin, dmax) = grad.domain(); let (dmin, dmax) = grad.domain();
let rng = fastrand::Rng::new(); let mut rng = fastrand::Rng::new();
// We add some randomness to the position that we use to // We add some randomness to the position that we use to
// index into the color gradient, so that we can avoid // index into the color gradient, so that we can avoid
@ -65,7 +65,7 @@ impl CachedGradient {
} }
}); });
fn noise(rng: &fastrand::Rng, noise_amount: usize) -> f64 { fn noise(rng: &mut fastrand::Rng, noise_amount: usize) -> f64 {
if noise_amount == 0 { if noise_amount == 0 {
0. 0.
} else { } else {
@ -77,7 +77,7 @@ impl CachedGradient {
GradientOrientation::Horizontal => { GradientOrientation::Horizontal => {
for (x, _, pixel) in imgbuf.enumerate_pixels_mut() { for (x, _, pixel) in imgbuf.enumerate_pixels_mut() {
*pixel = to_pixel(grad.at(remap( *pixel = to_pixel(grad.at(remap(
x as f64 + noise(&rng, noise_amount), x as f64 + noise(&mut rng, noise_amount),
0.0, 0.0,
fw, fw,
dmin, dmin,
@ -88,7 +88,7 @@ impl CachedGradient {
GradientOrientation::Vertical => { GradientOrientation::Vertical => {
for (_, y, pixel) in imgbuf.enumerate_pixels_mut() { for (_, y, pixel) in imgbuf.enumerate_pixels_mut() {
*pixel = to_pixel(grad.at(remap( *pixel = to_pixel(grad.at(remap(
y as f64 + noise(&rng, noise_amount), y as f64 + noise(&mut rng, noise_amount),
0.0, 0.0,
fh, fh,
dmin, dmin,
@ -103,7 +103,7 @@ impl CachedGradient {
let (x, y) = (x - fw / 2., y - fh / 2.); let (x, y) = (x - fw / 2., y - fh / 2.);
let t = x * f64::cos(angle) - y * f64::sin(angle); let t = x * f64::cos(angle) - y * f64::sin(angle);
*pixel = to_pixel(grad.at(remap( *pixel = to_pixel(grad.at(remap(
t + noise(&rng, noise_amount), t + noise(&mut rng, noise_amount),
-fw / 2., -fw / 2.,
fw / 2., fw / 2.,
dmin, dmin,
@ -126,12 +126,12 @@ impl CachedGradient {
let nx = if ((cx - x).abs() as usize) < noise_amount { let nx = if ((cx - x).abs() as usize) < noise_amount {
0. 0.
} else { } else {
noise(&rng, noise_amount) noise(&mut rng, noise_amount)
}; };
let ny = if ((cy - y).abs() as usize) < noise_amount { let ny = if ((cy - y).abs() as usize) < noise_amount {
0. 0.
} else { } else {
noise(&rng, noise_amount) noise(&mut rng, noise_amount)
}; };
let t = (nx + (x - cx).powi(2) + (ny + y - cy).powi(2)).sqrt() / radius; let t = (nx + (x - cx).powi(2) + (ny + y - cy).powi(2)).sqrt() / radius;