Bug 1313554 - Use brace-initialization to ShearArray. r=hiro
authorBoris Chiou <boris.chiou@gmail.com>
Fri, 28 Oct 2016 11:11:36 +0800
changeset 319936 9f38d8a746c2bc11cf1d372a2329c4bdfa06fc7c
parent 319935 62d6437ca10d344770c2433edd2e17689bfb4993
child 319937 5868e557eae14ab7ac1a3fc89fe50b71a8665b55
push id20749
push userryanvm@gmail.com
push dateSat, 29 Oct 2016 13:21:21 +0000
treeherderfx-team@1b170b39ed6b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1313554
milestone52.0a1
Bug 1313554 - Use brace-initialization to ShearArray. r=hiro MozReview-Commit-ID: 9dT7bpGpCEC
layout/style/StyleAnimationValue.cpp
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -710,29 +710,23 @@ AddTransformLists(double aCoeff1, const 
 
 static double
 ComputeTransform2DMatrixDistance(const Matrix& aMatrix1,
                                  const Matrix& aMatrix2)
 {
   Point3D scale1(1, 1, 1);
   Point3D translate1;
   gfxQuaternion rotate1;
-  nsStyleTransformMatrix::ShearArray shear1;
-  for (auto&& s : shear1) {
-    s = 0.0f;
-  }
+  nsStyleTransformMatrix::ShearArray shear1{0.0f, 0.0f, 0.0f};
   Decompose2DMatrix(aMatrix1, scale1, shear1, rotate1, translate1);
 
   Point3D scale2(1, 1, 1);
   Point3D translate2;
   gfxQuaternion rotate2;
-  nsStyleTransformMatrix::ShearArray shear2;
-  for (auto&& s : shear2) {
-    s = 0.0f;
-  }
+  nsStyleTransformMatrix::ShearArray shear2{0.0f, 0.0f, 0.0f};
   Decompose2DMatrix(aMatrix2, scale2, shear2, rotate2, translate2);
 
   // Note:
   // 1. Shear factor is the tangent value of shear angle, so we need to
   //    call atan() to get the angle. For 2D transform, we only have XYSHEAR.
   // 2. The quaternion vector of the decomposed 2d matrix is got by
   //    "gfxQuaternion(0, 0, sin(rotate/2), cos(rotate/2))"
   //                         ^^^^^^^^^^^^^  ^^^^^^^^^^^^^
@@ -767,31 +761,25 @@ ComputeTransform2DMatrixDistance(const M
 static double
 ComputeTransform3DMatrixDistance(const Matrix4x4& aMatrix1,
                                  const Matrix4x4& aMatrix2)
 {
   Point3D scale1(1, 1, 1);
   Point3D translate1;
   Point4D perspective1(0, 0, 0, 1);
   gfxQuaternion rotate1;
-  nsStyleTransformMatrix::ShearArray shear1;
-  for (auto&& s : shear1) {
-    s = 0.0f;
-  }
+  nsStyleTransformMatrix::ShearArray shear1{0.0f, 0.0f, 0.0f};
   Decompose3DMatrix(aMatrix1, scale1, shear1, rotate1, translate1,
                     perspective1);
 
   Point3D scale2(1, 1, 1);
   Point3D translate2;
   Point4D perspective2(0, 0, 0, 1);
   gfxQuaternion rotate2;
-  nsStyleTransformMatrix::ShearArray shear2;
-  for (auto&& s : shear2) {
-    s = 0.0f;
-  }
+  nsStyleTransformMatrix::ShearArray shear2{0.0f, 0.0f, 0.0f};
   Decompose3DMatrix(aMatrix2, scale2, shear2, rotate2, translate2,
                     perspective2);
 
   // Note:
   // 1. Shear factor is the tangent value of shear angle, so we need to
   //    call atan() to get the angle.
   // 2. We use the same way to get the rotate angle of two quaternion vectors as
   //    what we do for rotate3d.
@@ -1787,28 +1775,22 @@ StyleAnimationValue::InterpolateTransfor
                                                 double aProgress)
 {
   // Decompose both matrices
 
   // TODO: What do we do if one of these returns false (singular matrix)
   Point3D scale1(1, 1, 1), translate1;
   Point4D perspective1(0, 0, 0, 1);
   gfxQuaternion rotate1;
-  nsStyleTransformMatrix::ShearArray shear1;
-  for (auto&& s : shear1) {
-    s = 0.0f;
-  }
+  nsStyleTransformMatrix::ShearArray shear1{0.0f, 0.0f, 0.0f};
 
   Point3D scale2(1, 1, 1), translate2;
   Point4D perspective2(0, 0, 0, 1);
   gfxQuaternion rotate2;
-  nsStyleTransformMatrix::ShearArray shear2;
-  for (auto&& s : shear2) {
-    s = 0.0f;
-  }
+  nsStyleTransformMatrix::ShearArray shear2{0.0f, 0.0f, 0.0f};
 
   Matrix matrix2d1, matrix2d2;
   if (aMatrix1.Is2D(&matrix2d1) && aMatrix2.Is2D(&matrix2d2)) {
     Decompose2DMatrix(matrix2d1, scale1, shear1, rotate1, translate1);
     Decompose2DMatrix(matrix2d2, scale2, shear2, rotate2, translate2);
   } else {
     Decompose3DMatrix(aMatrix1, scale1, shear1,
                       rotate1, translate1, perspective1);