| Index: ui/gfx/transform_util.cc
|
| diff --git a/ui/gfx/transform_util.cc b/ui/gfx/transform_util.cc
|
| index 655ce57f2bb2b799cbf7da1b69164d97e5a42dd0..8295788c599562fa99a1a15bf9197d6e69b3d338 100644
|
| --- a/ui/gfx/transform_util.cc
|
| +++ b/ui/gfx/transform_util.cc
|
| @@ -107,7 +107,7 @@ bool Normalize(SkMatrix44& m) {
|
| // Cannot normalize.
|
| return false;
|
|
|
| - SkMScalar scale = 1.0 / m.get(3, 3);
|
| + SkMScalar scale = SK_MScalar1 / m.get(3, 3);
|
| for (int i = 0; i < 4; i++)
|
| for (int j = 0; j < 4; j++)
|
| m.set(i, j, m.get(i, j) * scale);
|
| @@ -148,15 +148,15 @@ SkMatrix44 BuildRotationMatrix(const DecomposedTransform& decomp) {
|
| SkMatrix44 matrix(SkMatrix44::kUninitialized_Constructor);
|
|
|
| // Implicitly calls matrix.setIdentity()
|
| - matrix.set3x3(1.0 - 2.0 * (y * y + z * z),
|
| - 2.0 * (x * y + z * w),
|
| - 2.0 * (x * z - y * w),
|
| - 2.0 * (x * y - z * w),
|
| - 1.0 - 2.0 * (x * x + z * z),
|
| - 2.0 * (y * z + x * w),
|
| - 2.0 * (x * z + y * w),
|
| - 2.0 * (y * z - x * w),
|
| - 1.0 - 2.0 * (x * x + y * y));
|
| + matrix.set3x3(SkDoubleToMScalar(1.0 - 2.0 * (y * y + z * z)),
|
| + SkDoubleToMScalar(2.0 * (x * y + z * w)),
|
| + SkDoubleToMScalar(2.0 * (x * z - y * w)),
|
| + SkDoubleToMScalar(2.0 * (x * y - z * w)),
|
| + SkDoubleToMScalar(1.0 - 2.0 * (x * x + z * z)),
|
| + SkDoubleToMScalar(2.0 * (y * z + x * w)),
|
| + SkDoubleToMScalar(2.0 * (x * z + y * w)),
|
| + SkDoubleToMScalar(2.0 * (y * z - x * w)),
|
| + SkDoubleToMScalar(1.0 - 2.0 * (x * x + y * y)));
|
| return matrix;
|
| }
|
|
|
| @@ -373,7 +373,7 @@ bool DecomposeTransform(DecomposedTransform* decomp,
|
| // Compute X scale factor and normalize first row.
|
| decomp->scale[0] = Length3(row[0]);
|
| if (decomp->scale[0] != 0.0)
|
| - Scale3(row[0], 1.0 / decomp->scale[0]);
|
| + Scale3(row[0], SK_MScalar1 / decomp->scale[0]);
|
|
|
| // Compute XY shear factor and make 2nd row orthogonal to 1st.
|
| decomp->skew[0] = Dot<3>(row[0], row[1]);
|
| @@ -382,7 +382,7 @@ bool DecomposeTransform(DecomposedTransform* decomp,
|
| // Now, compute Y scale and normalize 2nd row.
|
| decomp->scale[1] = Length3(row[1]);
|
| if (decomp->scale[1] != 0.0)
|
| - Scale3(row[1], 1.0 / decomp->scale[1]);
|
| + Scale3(row[1], SK_MScalar1 / decomp->scale[1]);
|
|
|
| decomp->skew[0] /= decomp->scale[1];
|
|
|
| @@ -395,7 +395,7 @@ bool DecomposeTransform(DecomposedTransform* decomp,
|
| // Next, get Z scale and normalize 3rd row.
|
| decomp->scale[2] = Length3(row[2]);
|
| if (decomp->scale[2] != 0.0)
|
| - Scale3(row[2], 1.0 / decomp->scale[2]);
|
| + Scale3(row[2], SK_MScalar1 / decomp->scale[2]);
|
|
|
| decomp->skew[1] /= decomp->scale[2];
|
| decomp->skew[2] /= decomp->scale[2];
|
| @@ -413,14 +413,17 @@ bool DecomposeTransform(DecomposedTransform* decomp,
|
| }
|
| }
|
|
|
| - decomp->quaternion[0] =
|
| - 0.5 * std::sqrt(std::max(1.0 + row[0][0] - row[1][1] - row[2][2], 0.0));
|
| - decomp->quaternion[1] =
|
| - 0.5 * std::sqrt(std::max(1.0 - row[0][0] + row[1][1] - row[2][2], 0.0));
|
| - decomp->quaternion[2] =
|
| - 0.5 * std::sqrt(std::max(1.0 - row[0][0] - row[1][1] + row[2][2], 0.0));
|
| - decomp->quaternion[3] =
|
| - 0.5 * std::sqrt(std::max(1.0 + row[0][0] + row[1][1] + row[2][2], 0.0));
|
| + double row00 = SkMScalarToDouble(row[0][0]);
|
| + double row11 = SkMScalarToDouble(row[1][1]);
|
| + double row22 = SkMScalarToDouble(row[2][2]);
|
| + decomp->quaternion[0] = SkDoubleToMScalar(
|
| + 0.5 * std::sqrt(std::max(1.0 + row00 - row11 - row22, 0.0)));
|
| + decomp->quaternion[1] = SkDoubleToMScalar(
|
| + 0.5 * std::sqrt(std::max(1.0 - row00 + row11 - row22, 0.0)));
|
| + decomp->quaternion[2] = SkDoubleToMScalar(
|
| + 0.5 * std::sqrt(std::max(1.0 - row00 - row11 + row22, 0.0)));
|
| + decomp->quaternion[3] = SkDoubleToMScalar(
|
| + 0.5 * std::sqrt(std::max(1.0 + row00 + row11 + row22, 0.0)));
|
|
|
| if (row[2][1] > row[1][2])
|
| decomp->quaternion[0] = -decomp->quaternion[0];
|
|
|