Chromium Code Reviews| Index: webkit/compositor_bindings/web_transformation_matrix_util.cc |
| diff --git a/webkit/compositor_bindings/web_transformation_matrix_util.cc b/webkit/compositor_bindings/web_transformation_matrix_util.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4dfaa437035a0efc0378cd869740f0f6726242df |
| --- /dev/null |
| +++ b/webkit/compositor_bindings/web_transformation_matrix_util.cc |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "webkit/compositor_bindings/web_transformation_matrix_util.h" |
| + |
| +using WebKit::WebTransformationMatrix; |
| + |
| +namespace webkit { |
| + |
| +gfx::Transform WebTransformationMatrixUtil::ToTransform( |
| + const WebTransformationMatrix& matrix) { |
| + // TODO(jamesr): When gfx::Transform provides a constructor that does not |
| + // initialize the matrix, use that. |
| + gfx::Transform transform; |
|
Ian Vollick
2013/01/25 17:59:16
We do have such a constructor now.
ajuma
2013/01/25 19:28:26
Done.
|
| + transform.matrix().setDouble(0, 0, matrix.m11()); |
| + transform.matrix().setDouble(0, 1, matrix.m21()); |
| + transform.matrix().setDouble(0, 2, matrix.m31()); |
| + transform.matrix().setDouble(0, 3, matrix.m41()); |
| + transform.matrix().setDouble(1, 0, matrix.m12()); |
| + transform.matrix().setDouble(1, 1, matrix.m22()); |
| + transform.matrix().setDouble(1, 2, matrix.m32()); |
| + transform.matrix().setDouble(1, 3, matrix.m42()); |
| + transform.matrix().setDouble(2, 0, matrix.m13()); |
| + transform.matrix().setDouble(2, 1, matrix.m23()); |
| + transform.matrix().setDouble(2, 2, matrix.m33()); |
| + transform.matrix().setDouble(2, 3, matrix.m43()); |
| + transform.matrix().setDouble(3, 0, matrix.m14()); |
| + transform.matrix().setDouble(3, 1, matrix.m24()); |
| + transform.matrix().setDouble(3, 2, matrix.m34()); |
| + transform.matrix().setDouble(3, 3, matrix.m44()); |
| + return transform; |
| +} |
| + |
| +WebTransformationMatrix WebTransformationMatrixUtil::ToWebTransformationMatrix( |
| + const gfx::Transform& transform) { |
| + return WebTransformationMatrix(transform.matrix().getDouble(0, 0), |
| + transform.matrix().getDouble(1, 0), |
| + transform.matrix().getDouble(2, 0), |
| + transform.matrix().getDouble(3, 0), |
| + transform.matrix().getDouble(0, 1), |
| + transform.matrix().getDouble(1, 1), |
| + transform.matrix().getDouble(2, 1), |
| + transform.matrix().getDouble(3, 1), |
| + transform.matrix().getDouble(0, 2), |
| + transform.matrix().getDouble(1, 2), |
| + transform.matrix().getDouble(2, 2), |
| + transform.matrix().getDouble(3, 2), |
| + transform.matrix().getDouble(0, 3), |
| + transform.matrix().getDouble(1, 3), |
| + transform.matrix().getDouble(2, 3), |
| + transform.matrix().getDouble(3, 3)); |
| + |
| +} |
| + |
| +} // namespace webkit |