mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Consider f64 epsilon for add_weighted portions.
This patch also degrade assert! to debug_assert! since crash reports don't show us useful information so far (no assertion messages at all).
This commit is contained in:
parent
4b91014b14
commit
0d43281fad
1 changed files with 5 additions and 3 deletions
|
@ -2272,9 +2272,11 @@ impl Animatable for MatrixDecomposed3D {
|
|||
/// https://drafts.csswg.org/css-transforms/#interpolation-of-decomposed-3d-matrix-values
|
||||
fn add_weighted(&self, other: &Self, self_portion: f64, other_portion: f64)
|
||||
-> Result<Self, ()> {
|
||||
assert!(self_portion + other_portion == 1.0f64 ||
|
||||
other_portion == 1.0f64,
|
||||
"add_weighted should only be used for interpolating or accumulating transforms");
|
||||
use std::f64;
|
||||
|
||||
debug_assert!((self_portion + other_portion - 1.0f64).abs() <= f64::EPSILON ||
|
||||
other_portion == 1.0f64,
|
||||
"add_weighted should only be used for interpolating or accumulating transforms");
|
||||
|
||||
let mut sum = *self;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue