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:
Emilio Cobos Álvarez 2018-05-26 23:48:55 +02:00
parent 66b8bd2829
commit b199ca864a
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -2161,6 +2161,7 @@ impl From<MatrixDecomposed3D> for Matrix3D {
% endfor
// Apply rotation
{
let x = decomposed.quaternion.0;
let y = decomposed.quaternion.1;
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;
matrix = multiply(rotation_matrix, matrix);
}
// Apply skew
{
let mut temp = Matrix3D::identity();
if decomposed.skew.2 != 0.0 {
temp.m32 = decomposed.skew.2;
matrix = multiply(temp, matrix);
temp.m32 = 0.0;
}
if decomposed.skew.1 != 0.0 {
temp.m32 = 0.0;
temp.m31 = decomposed.skew.1;
matrix = multiply(temp, matrix);
temp.m31 = 0.0;
}
if decomposed.skew.0 != 0.0 {
temp.m31 = 0.0;
temp.m21 = decomposed.skew.0;
matrix = multiply(temp, matrix);
}
}
// Apply scale
% for i in range(1, 4):