chore: audit components
This commit is contained in:
@@ -12,6 +12,16 @@ pub(crate) trait ThemeSource: 'static {
|
||||
fn label(&self) -> &'static str;
|
||||
}
|
||||
|
||||
/// Narrows an f64 color component to f32, clamping to the 0..=1 range and
|
||||
/// mapping non-finite values to 0.0 rather than truncating garbage silently.
|
||||
pub(crate) fn narrow_component(value: f64) -> f32 {
|
||||
if value.is_finite() {
|
||||
value.clamp(0.0, 1.0) as f32
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub(crate) fn platform_source() -> Box<dyn ThemeSource> {
|
||||
Box::new(macos::MacosSource::default())
|
||||
|
||||
Reference in New Issue
Block a user