Bug 1459403: Cleanup multiply(). r?hiro
We assign all the members, the result matrix doesn't really need to be any clone
of a.
MozReview-Commit-ID: 3NkhvyfqQL
--- a/servo/components/style/properties/helpers/animated_properties.mako.rs
+++ b/servo/components/style/properties/helpers/animated_properties.mako.rs
@@ -2210,26 +2210,27 @@ impl From<MatrixDecomposed3D> for Matrix
% endfor
matrix
}
}
// Multiplication of two 4x4 matrices.
fn multiply(a: Matrix3D, b: Matrix3D) -> Matrix3D {
- let mut a_clone = a;
+ Matrix3D {
% for i in range(1, 5):
- % for j in range(1, 5):
- a_clone.m${i}${j} = (a.m${i}1 * b.m1${j}) +
- (a.m${i}2 * b.m2${j}) +
- (a.m${i}3 * b.m3${j}) +
- (a.m${i}4 * b.m4${j});
- % endfor
+ % for j in range(1, 5):
+ m${i}${j}:
+ a.m${i}1 * b.m1${j} +
+ a.m${i}2 * b.m2${j} +
+ a.m${i}3 * b.m3${j} +
+ a.m${i}4 * b.m4${j},
% endfor
- a_clone
+ % endfor
+ }
}
impl Matrix3D {
fn is_3d(&self) -> bool {
self.m13 != 0.0 || self.m14 != 0.0 ||
self.m23 != 0.0 || self.m24 != 0.0 ||
self.m31 != 0.0 || self.m32 != 0.0 || self.m33 != 1.0 || self.m34 != 0.0 ||
self.m43 != 0.0 || self.m44 != 1.0