Backed out changeset 2134cb641802 (bug 1748499) for causing wrench bustages.

CLOSED TREE
This commit is contained in:
Alexandru Michis 2022-01-05 20:16:42 +02:00
Родитель 4136c5f8f3
Коммит ae59fd393e
1 изменённых файлов: 3 добавлений и 19 удалений

Просмотреть файл

@ -1450,14 +1450,11 @@ impl<T: MallocSizeOf> MallocSizeOf for PrimaryArc<T> {
/// modifications:
///
/// * Removed `xMajor` parameter.
/// * All arithmetics is done with double precision.
pub fn scale_factors<Src, Dst>(
mat: &Transform3D<f32, Src, Dst>
) -> (f32, f32) {
let m11 = mat.m11 as f64;
let m12 = mat.m12 as f64;
// Determinant is just of the 2D component.
let det = m11 * mat.m22 as f64 - m12 * mat.m21 as f64;
let det = mat.m11 * mat.m22 - mat.m12 * mat.m21;
if det == 0.0 {
return (0.0, 0.0);
}
@ -1465,25 +1462,12 @@ pub fn scale_factors<Src, Dst>(
// ignore mirroring
let det = det.abs();
let major = (m11 * m11 + m12 * m12).sqrt();
let major = (mat.m11 * mat.m11 + mat.m12 * mat.m12).sqrt();
let minor = if major != 0.0 { det / major } else { 0.0 };
(major as f32, minor as f32)
(major, minor)
}
#[test]
fn scale_factors_large() {
// https://bugzilla.mozilla.org/show_bug.cgi?id=1748499
let mat = Transform3D::<f32, (), ()>::new(
1.6534229920333123e27, 3.673100922561787e27, 0.0, 0.0,
-3.673100922561787e27, 1.6534229920333123e27, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
-828140552192.0, -1771307401216.0, 0.0, 1.0,
);
let (major, minor) = scale_factors(&mat);
assert!(major.is_normal() && minor.is_normal());
}
/// Clamp scaling factor to a power of two.
///
/// This code comes from gecko gfx/thebes/gfxUtils.cpp with the following