mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Use rewritten decomposition of 2d matrix to compute distance.
So we can align the result with interpolation.
This commit is contained in:
parent
9b76cd9d1c
commit
172b4aadda
1 changed files with 12 additions and 0 deletions
|
@ -1443,6 +1443,7 @@ impl Animate for ComputedMatrix {
|
||||||
|
|
||||||
impl ComputeSquaredDistance for ComputedMatrix {
|
impl ComputeSquaredDistance for ComputedMatrix {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[cfg(feature = "servo")]
|
||||||
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
|
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
|
||||||
if self.is_3d() || other.is_3d() {
|
if self.is_3d() || other.is_3d() {
|
||||||
let from = decompose_3d_matrix(*self)?;
|
let from = decompose_3d_matrix(*self)?;
|
||||||
|
@ -1454,6 +1455,17 @@ impl ComputeSquaredDistance for ComputedMatrix {
|
||||||
from.compute_squared_distance(&to)
|
from.compute_squared_distance(&to)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
|
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
|
||||||
|
let (from, to) = if self.is_3d() || other.is_3d() {
|
||||||
|
(decompose_3d_matrix(*self)?, decompose_3d_matrix(*other)?)
|
||||||
|
} else {
|
||||||
|
(decompose_2d_matrix(self)?, decompose_2d_matrix(other)?)
|
||||||
|
};
|
||||||
|
from.compute_squared_distance(&to)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ComputedMatrix> for MatrixDecomposed2D {
|
impl From<ComputedMatrix> for MatrixDecomposed2D {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue