Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,12 @@ fn image_to_mask(data: &mut [rgb::RGBA8]) {
}
}

// TODO: https://github.com/rust-lang/rust/issues/44095
/// Bounds `f64` number.
#[inline]
fn f64_bound(min: f64, val: f64, max: f64) -> f64 {
debug_assert!(min.is_finite());
debug_assert!(val.is_finite());
debug_assert!(max.is_finite());

if val > max {
max
} else if val < min {
min
} else {
val
}
val.clamp(min, max)
}
10 changes: 1 addition & 9 deletions svgfilters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,21 +251,13 @@ pub fn from_linear_rgb(data: &mut [RGBA8]) {
}
}


// TODO: https://github.com/rust-lang/rust/issues/44095
#[inline]
fn f64_bound(min: f64, val: f64, max: f64) -> f64 {
debug_assert!(min.is_finite());
debug_assert!(val.is_finite());
debug_assert!(max.is_finite());

if val > max {
max
} else if val < min {
min
} else {
val
}
val.clamp(min, max)
}


Expand Down
9 changes: 1 addition & 8 deletions usvg/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,14 @@

use crate::{Align, AspectRatio, Rect, ScreenSize, Size, Transform, ViewBox};

// TODO: https://github.com/rust-lang/rust/issues/44095
/// Bounds `f64` number.
#[inline]
pub(crate) fn f64_bound(min: f64, val: f64, max: f64) -> f64 {
debug_assert!(min.is_finite());
debug_assert!(val.is_finite());
debug_assert!(max.is_finite());

if val > max {
max
} else if val < min {
min
} else {
val
}
val.clamp(min, max)
}

/// Converts `viewBox` to `Transform`.
Expand Down