mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
style: Move skew and rotation application to their own scope for clarity.
The skew resetting of temp I think fixes a bug in presence of skew in every direction, but again haven't double-checked. Bug: 1459403 Reviewed-by: hiro MozReview-Commit-ID: Bn93CoaG8Bu
This commit is contained in:
parent
66b8bd2829
commit
b199ca864a
1 changed files with 35 additions and 31 deletions
|
@ -2161,6 +2161,7 @@ impl From<MatrixDecomposed3D> for Matrix3D {
|
||||||
% endfor
|
% endfor
|
||||||
|
|
||||||
// Apply rotation
|
// Apply rotation
|
||||||
|
{
|
||||||
let x = decomposed.quaternion.0;
|
let x = decomposed.quaternion.0;
|
||||||
let y = decomposed.quaternion.1;
|
let y = decomposed.quaternion.1;
|
||||||
let z = decomposed.quaternion.2;
|
let z = decomposed.quaternion.2;
|
||||||
|
@ -2180,25 +2181,28 @@ impl From<MatrixDecomposed3D> for Matrix3D {
|
||||||
rotation_matrix.m33 = 1.0 - 2.0 * (x * x + y * y) as f32;
|
rotation_matrix.m33 = 1.0 - 2.0 * (x * x + y * y) as f32;
|
||||||
|
|
||||||
matrix = multiply(rotation_matrix, matrix);
|
matrix = multiply(rotation_matrix, matrix);
|
||||||
|
}
|
||||||
|
|
||||||
// Apply skew
|
// Apply skew
|
||||||
|
{
|
||||||
let mut temp = Matrix3D::identity();
|
let mut temp = Matrix3D::identity();
|
||||||
if decomposed.skew.2 != 0.0 {
|
if decomposed.skew.2 != 0.0 {
|
||||||
temp.m32 = decomposed.skew.2;
|
temp.m32 = decomposed.skew.2;
|
||||||
matrix = multiply(temp, matrix);
|
matrix = multiply(temp, matrix);
|
||||||
|
temp.m32 = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if decomposed.skew.1 != 0.0 {
|
if decomposed.skew.1 != 0.0 {
|
||||||
temp.m32 = 0.0;
|
|
||||||
temp.m31 = decomposed.skew.1;
|
temp.m31 = decomposed.skew.1;
|
||||||
matrix = multiply(temp, matrix);
|
matrix = multiply(temp, matrix);
|
||||||
|
temp.m31 = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if decomposed.skew.0 != 0.0 {
|
if decomposed.skew.0 != 0.0 {
|
||||||
temp.m31 = 0.0;
|
|
||||||
temp.m21 = decomposed.skew.0;
|
temp.m21 = decomposed.skew.0;
|
||||||
matrix = multiply(temp, matrix);
|
matrix = multiply(temp, matrix);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Apply scale
|
// Apply scale
|
||||||
% for i in range(1, 4):
|
% for i in range(1, 4):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue