OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/dom/DOMMatrix.h" | 6 #include "core/dom/DOMMatrix.h" |
7 | 7 |
8 namespace blink { | 8 namespace blink { |
9 | 9 |
10 DOMMatrix* DOMMatrix::create() | 10 DOMMatrix* DOMMatrix::create() |
11 { | 11 { |
12 return new DOMMatrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); | 12 return new DOMMatrix(TransformationMatrix()); |
13 } | 13 } |
14 | 14 |
15 DOMMatrix* DOMMatrix::create(DOMMatrixReadOnly* other) | 15 DOMMatrix* DOMMatrix::create(DOMMatrixReadOnly* other) |
16 { | 16 { |
17 return new DOMMatrix(other->m11(), other->m12(), other->m13(), other->m14(), | 17 return new DOMMatrix(other->matrix(), other->is2D()); |
18 other->m21(), other->m22(), other->m23(), other->m24(), | |
19 other->m31(), other->m32(), other->m33(), other->m34(), | |
20 other->m41(), other->m42(), other->m43(), other->m44(), | |
21 other->is2D()); | |
22 } | 18 } |
23 | 19 |
24 DOMMatrix::DOMMatrix(double m11, double m12, double m13, double m14, | 20 DOMMatrix::DOMMatrix(const TransformationMatrix& matrix, bool is2D) |
25 double m21, double m22, double m23, double m24, | |
26 double m31, double m32, double m33, double m34, | |
27 double m41, double m42, double m43, double m44, | |
28 bool is2D) | |
29 { | 21 { |
30 m_matrix[0][0] = m11; | 22 m_matrix = matrix; |
31 m_matrix[0][1] = m12; | |
32 m_matrix[0][2] = m13; | |
33 m_matrix[0][3] = m14; | |
34 m_matrix[1][0] = m21; | |
35 m_matrix[1][1] = m22; | |
36 m_matrix[1][2] = m23; | |
37 m_matrix[1][3] = m24; | |
38 m_matrix[2][0] = m31; | |
39 m_matrix[2][1] = m32; | |
40 m_matrix[2][2] = m33; | |
41 m_matrix[2][3] = m34; | |
42 m_matrix[3][0] = m41; | |
43 m_matrix[3][1] = m42; | |
44 m_matrix[3][2] = m43; | |
45 m_matrix[3][3] = m44; | |
46 m_is2D = is2D; | 23 m_is2D = is2D; |
47 } | 24 } |
48 | 25 |
49 void DOMMatrix::setIs2D(bool value) | 26 void DOMMatrix::setIs2D(bool value) |
50 { | 27 { |
51 if (m_is2D) | 28 if (m_is2D) |
52 m_is2D = value; | 29 m_is2D = value; |
53 } | 30 } |
54 | 31 |
55 } // namespace blink | 32 } // namespace blink |
OLD | NEW |