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

View File

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

View File

@ -50,7 +50,7 @@ impl CachedGradient {
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
// 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 {
0.
} else {
@ -77,7 +77,7 @@ impl CachedGradient {
GradientOrientation::Horizontal => {
for (x, _, pixel) in imgbuf.enumerate_pixels_mut() {
*pixel = to_pixel(grad.at(remap(
x as f64 + noise(&rng, noise_amount),
x as f64 + noise(&mut rng, noise_amount),
0.0,
fw,
dmin,
@ -88,7 +88,7 @@ impl CachedGradient {
GradientOrientation::Vertical => {
for (_, y, pixel) in imgbuf.enumerate_pixels_mut() {
*pixel = to_pixel(grad.at(remap(
y as f64 + noise(&rng, noise_amount),
y as f64 + noise(&mut rng, noise_amount),
0.0,
fh,
dmin,
@ -103,7 +103,7 @@ impl CachedGradient {
let (x, y) = (x - fw / 2., y - fh / 2.);
let t = x * f64::cos(angle) - y * f64::sin(angle);
*pixel = to_pixel(grad.at(remap(
t + noise(&rng, noise_amount),
t + noise(&mut rng, noise_amount),
-fw / 2.,
fw / 2.,
dmin,
@ -126,12 +126,12 @@ impl CachedGradient {
let nx = if ((cx - x).abs() as usize) < noise_amount {
0.
} else {
noise(&rng, noise_amount)
noise(&mut rng, noise_amount)
};
let ny = if ((cy - y).abs() as usize) < noise_amount {
0.
} else {
noise(&rng, noise_amount)
noise(&mut rng, noise_amount)
};
let t = (nx + (x - cx).powi(2) + (ny + y - cy).powi(2)).sqrt() / radius;