1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30:03 -04:00

Remove some debug asserts (#4826)

* Closes https://github.com/emilk/egui/issues/4825
This commit is contained in:
Emil Ernerfeldt
2024-07-15 11:20:22 +02:00
committed by GitHub
parent 1bee7bfefa
commit 8d2df5491e
4 changed files with 8 additions and 6 deletions

View File

@@ -201,7 +201,7 @@ impl Color32 {
/// This is perceptually even, and faster that [`Self::linear_multiply`].
#[inline]
pub fn gamma_multiply(self, factor: f32) -> Self {
debug_assert!(0.0 <= factor && factor <= 1.0);
debug_assert!(0.0 <= factor && factor.is_finite());
let Self([r, g, b, a]) = self;
Self([
(r as f32 * factor + 0.5) as u8,
@@ -217,7 +217,7 @@ impl Color32 {
/// You likely want to use [`Self::gamma_multiply`] instead.
#[inline]
pub fn linear_multiply(self, factor: f32) -> Self {
debug_assert!(0.0 <= factor && factor <= 1.0);
debug_assert!(0.0 <= factor && factor.is_finite());
// As an unfortunate side-effect of using premultiplied alpha
// we need a somewhat expensive conversion to linear space and back.
Rgba::from(self).multiply(factor).into()