Bug 1458715: Fix perspective interpolation. r=hiro

It's not sound to insert random matrices in random positions in the transform
operation list.

I cannot make any sense of what the old code was trying to do.

MozReview-Commit-ID: 5BtCiueEPlR
This commit is contained in:
Emilio Cobos Álvarez 2018-05-03 10:15:15 +02:00
Родитель c6b419d0eb
Коммит b22479d43d
2 изменённых файлов: 8 добавлений и 23 удалений

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

@ -1291,16 +1291,8 @@ impl Animate for ComputedTransformOperation {
&TransformOperation::Perspective(ref fd),
&TransformOperation::Perspective(ref td),
) => {
let mut fd_matrix = Matrix3D::identity();
let mut td_matrix = Matrix3D::identity();
if fd.px() > 0. {
fd_matrix.m34 = -1. / fd.px();
}
if td.px() > 0. {
td_matrix.m34 = -1. / td.px();
}
Ok(TransformOperation::Matrix3D(
fd_matrix.animate(&td_matrix, procedure)?,
Ok(TransformOperation::Perspective(
fd.animate(td, procedure)?
))
},
_ if self.is_translate() && other.is_translate() => {
@ -2640,16 +2632,7 @@ impl ComputeSquaredDistance for ComputedTransformOperation {
&TransformOperation::Perspective(ref fd),
&TransformOperation::Perspective(ref td),
) => {
let mut fd_matrix = Matrix3D::identity();
let mut td_matrix = Matrix3D::identity();
if fd.px() > 0. {
fd_matrix.m34 = -1. / fd.px();
}
if td.px() > 0. {
td_matrix.m34 = -1. / td.px();
}
fd_matrix.compute_squared_distance(&td_matrix)
fd.compute_squared_distance(td)
}
(
&TransformOperation::Perspective(ref p),
@ -2658,6 +2641,8 @@ impl ComputeSquaredDistance for ComputedTransformOperation {
&TransformOperation::Matrix3D(ref m),
&TransformOperation::Perspective(ref p),
) => {
// FIXME(emilio): Is this right? Why interpolating this with
// Perspective but not with anything else?
let mut p_matrix = Matrix3D::identity();
if p.px() > 0. {
p_matrix.m34 = -1. / p.px();

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

@ -251,11 +251,11 @@ impl ToAnimatedZero for TransformOperation {
generic::TransformOperation::Rotate(_) => {
Ok(generic::TransformOperation::Rotate(Angle::zero()))
},
generic::TransformOperation::Perspective(..) |
generic::TransformOperation::Perspective(ref l) => {
Ok(generic::TransformOperation::Perspective(l.to_animated_zero()?))
},
generic::TransformOperation::AccumulateMatrix { .. } |
generic::TransformOperation::InterpolateMatrix { .. } => {
// Perspective: We convert a perspective function into an equivalent
// ComputedMatrix, and then decompose/interpolate/recompose these matrices.
// AccumulateMatrix/InterpolateMatrix: We do interpolation on
// AccumulateMatrix/InterpolateMatrix by reading it as a ComputedMatrix
// (with layout information), and then do matrix interpolation.