Skip to content

Commit

Permalink
Avoid color crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Loirooriol committed Nov 18, 2023
1 parent 4a633b7 commit 80c0ad4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions components/layout/display_list/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ impl ToLayout for AbsoluteColor {
fn to_layout(&self) -> Self::Type {
let rgba = self.to_color_space(ColorSpace::Srgb);
wr::ColorF::new(
rgba.components.0,
rgba.components.1,
rgba.components.2,
rgba.components.0.clamp(0.0, 1.0),
rgba.components.1.clamp(0.0, 1.0),
rgba.components.2.clamp(0.0, 1.0),
rgba.alpha,
)
}
Expand Down
6 changes: 3 additions & 3 deletions components/layout_2020/display_list/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,9 +752,9 @@ impl<'a> BuilderForBoxFragment<'a> {
fn rgba(color: AbsoluteColor) -> wr::ColorF {
let rgba = color.to_color_space(ColorSpace::Srgb);
wr::ColorF::new(
rgba.components.0,
rgba.components.1,
rgba.components.2,
rgba.components.0.clamp(0.0, 1.0),
rgba.components.1.clamp(0.0, 1.0),
rgba.components.2.clamp(0.0, 1.0),
rgba.alpha,
)
}
Expand Down

0 comments on commit 80c0ad4

Please sign in to comment.