diff options
-rw-r--r-- | ui/gfx/transform.cc | 20 | ||||
-rw-r--r-- | ui/gfx/transform_util.cc | 42 |
2 files changed, 29 insertions, 33 deletions
diff --git a/ui/gfx/transform.cc b/ui/gfx/transform.cc index df3ed9f..5e87998 100644 --- a/ui/gfx/transform.cc +++ b/ui/gfx/transform.cc @@ -83,7 +83,7 @@ void Transform::RotateAboutXAxis(double degrees) { 0, cosTheta, sinTheta, 0, -sinTheta, cosTheta); } else { - SkMatrix44 rot; + SkMatrix44 rot(SkMatrix44::kUninitialized_Constructor); rot.set3x3(1, 0, 0, 0, cosTheta, sinTheta, 0, -sinTheta, cosTheta); @@ -102,7 +102,7 @@ void Transform::RotateAboutYAxis(double degrees) { 0, 1, 0, sinTheta, 0, cosTheta); } else { - SkMatrix44 rot; + SkMatrix44 rot(SkMatrix44::kUninitialized_Constructor); rot.set3x3(cosTheta, 0, -sinTheta, 0, 1, 0, sinTheta, 0, cosTheta); @@ -119,7 +119,7 @@ void Transform::RotateAboutZAxis(double degrees) { -sinTheta, cosTheta, 0, 0, 0, 1); } else { - SkMatrix44 rot; + SkMatrix44 rot(SkMatrix44::kUninitialized_Constructor); rot.set3x3(cosTheta, sinTheta, 0, -sinTheta, cosTheta, 0, 0, 0, 1); @@ -134,7 +134,7 @@ void Transform::RotateAbout(const Vector3dF& axis, double degrees) { SkDoubleToMScalar(axis.z()), SkDoubleToMScalar(degrees)); } else { - SkMatrix44 rot; + SkMatrix44 rot(SkMatrix44::kUninitialized_Constructor); rot.setRotateDegreesAbout(SkDoubleToMScalar(axis.x()), SkDoubleToMScalar(axis.y()), SkDoubleToMScalar(axis.z()), @@ -167,7 +167,7 @@ void Transform::SkewX(double angle_x) { if (matrix_.isIdentity()) matrix_.setDouble(0, 1, TanDegrees(angle_x)); else { - SkMatrix44 skew; + SkMatrix44 skew(SkMatrix44::kIdentity_Constructor); skew.setDouble(0, 1, TanDegrees(angle_x)); matrix_.preConcat(skew); } @@ -177,7 +177,7 @@ void Transform::SkewY(double angle_y) { if (matrix_.isIdentity()) matrix_.setDouble(1, 0, TanDegrees(angle_y)); else { - SkMatrix44 skew; + SkMatrix44 skew(SkMatrix44::kIdentity_Constructor); skew.setDouble(1, 0, TanDegrees(angle_y)); matrix_.preConcat(skew); } @@ -189,7 +189,7 @@ void Transform::ApplyPerspectiveDepth(double depth) { if (matrix_.isIdentity()) matrix_.setDouble(3, 2, -1.0 / depth); else { - SkMatrix44 m; + SkMatrix44 m(SkMatrix44::kIdentity_Constructor); m.setDouble(3, 2, -1.0 / depth); matrix_.preConcat(m); } @@ -321,7 +321,7 @@ void Transform::TransformPoint(Point3F& point) const { bool Transform::TransformPointReverse(Point& point) const { // TODO(sad): Try to avoid trying to invert the matrix. - SkMatrix44 inverse; + SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor); if (!matrix_.invert(&inverse)) return false; @@ -331,7 +331,7 @@ bool Transform::TransformPointReverse(Point& point) const { bool Transform::TransformPointReverse(Point3F& point) const { // TODO(sad): Try to avoid trying to invert the matrix. - SkMatrix44 inverse; + SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor); if (!matrix_.invert(&inverse)) return false; @@ -353,7 +353,7 @@ bool Transform::TransformRectReverse(RectF* rect) const { if (matrix_.isIdentity()) return true; - SkMatrix44 inverse; + SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor); if (!matrix_.invert(&inverse)) return false; diff --git a/ui/gfx/transform_util.cc b/ui/gfx/transform_util.cc index c8ef573..9db41c3 100644 --- a/ui/gfx/transform_util.cc +++ b/ui/gfx/transform_util.cc @@ -166,7 +166,7 @@ bool DecomposeTransform(DecomposedTransform* decomp, // Solve the equation by inverting perspectiveMatrix and multiplying // rhs by the inverse. - SkMatrix44 inversePerspectiveMatrix; + SkMatrix44 inversePerspectiveMatrix(SkMatrix44::kUninitialized_Constructor); if (!perspectiveMatrix.invert(&inversePerspectiveMatrix)) return false; @@ -258,35 +258,33 @@ bool DecomposeTransform(DecomposedTransform* decomp, // Taken from http://www.w3.org/TR/css3-transforms/. Transform ComposeTransform(const DecomposedTransform& decomp) { - SkMatrix44 matrix; + SkMatrix44 matrix(SkMatrix44::kIdentity_Constructor); for (int i = 0; i < 4; i++) matrix.setDouble(3, i, decomp.perspective[i]); - SkMatrix44 tempTranslation; - tempTranslation.setTranslate(SkDoubleToMScalar(decomp.translate[0]), - SkDoubleToMScalar(decomp.translate[1]), - SkDoubleToMScalar(decomp.translate[2])); - matrix.preConcat(tempTranslation); + matrix.preTranslate(SkDoubleToMScalar(decomp.translate[0]), + SkDoubleToMScalar(decomp.translate[1]), + SkDoubleToMScalar(decomp.translate[2])); double x = decomp.quaternion[0]; double y = decomp.quaternion[1]; double z = decomp.quaternion[2]; double w = decomp.quaternion[3]; - SkMatrix44 rotation_matrix; - rotation_matrix.setDouble(0, 0, 1.0 - 2.0 * (y * y + z * z)); - rotation_matrix.setDouble(0, 1, 2.0 * (x * y - z * w)); - rotation_matrix.setDouble(0, 2, 2.0 * (x * z + y * w)); - rotation_matrix.setDouble(1, 0, 2.0 * (x * y + z * w)); - rotation_matrix.setDouble(1, 1, 1.0 - 2.0 * (x * x + z * z)); - rotation_matrix.setDouble(1, 2, 2.0 * (y * z - x * w)); - rotation_matrix.setDouble(2, 0, 2.0 * (x * z - y * w)); - rotation_matrix.setDouble(2, 1, 2.0 * (y * z + x * w)); - rotation_matrix.setDouble(2, 2, 1.0 - 2.0 * (x * x + y * y)); + SkMatrix44 rotation_matrix(SkMatrix44::kUninitialized_Constructor); + rotation_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.preConcat(rotation_matrix); - SkMatrix44 temp; + SkMatrix44 temp(SkMatrix44::kIdentity_Constructor); if (decomp.skew[2]) { temp.setDouble(1, 2, decomp.skew[2]); matrix.preConcat(temp); @@ -304,11 +302,9 @@ Transform ComposeTransform(const DecomposedTransform& decomp) { matrix.preConcat(temp); } - SkMatrix44 tempScale; - tempScale.setScale(SkDoubleToMScalar(decomp.scale[0]), - SkDoubleToMScalar(decomp.scale[1]), - SkDoubleToMScalar(decomp.scale[2])); - matrix.preConcat(tempScale); + matrix.preScale(SkDoubleToMScalar(decomp.scale[0]), + SkDoubleToMScalar(decomp.scale[1]), + SkDoubleToMScalar(decomp.scale[2])); Transform to_return; to_return.matrix() = matrix; |