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 "core/dom/DOMMatrix.h" | 5 #include "core/dom/DOMMatrix.h" |
6 | 6 |
7 namespace blink { | 7 namespace blink { |
8 | 8 |
9 DOMMatrix* DOMMatrix::create() | 9 DOMMatrix* DOMMatrix::create() |
10 { | 10 { |
11 return new DOMMatrix(TransformationMatrix()); | 11 return new DOMMatrix(TransformationMatrix()); |
12 } | 12 } |
13 | 13 |
14 DOMMatrix* DOMMatrix::create(DOMMatrixReadOnly* other) | 14 DOMMatrix* DOMMatrix::create(DOMMatrixReadOnly* other) |
15 { | 15 { |
16 return new DOMMatrix(other->matrix(), other->is2D()); | 16 return new DOMMatrix(other->matrix(), other->is2D()); |
17 } | 17 } |
18 | 18 |
| 19 DOMMatrix* DOMMatrix::create(const SkMatrix44& matrix) |
| 20 { |
| 21 TransformationMatrix transformationMatrix(matrix); |
| 22 return new DOMMatrix(transformationMatrix, transformationMatrix.isAffine()); |
| 23 } |
| 24 |
19 DOMMatrix::DOMMatrix(const TransformationMatrix& matrix, bool is2D) | 25 DOMMatrix::DOMMatrix(const TransformationMatrix& matrix, bool is2D) |
20 { | 26 { |
21 m_matrix = TransformationMatrix::create(matrix); | 27 m_matrix = TransformationMatrix::create(matrix); |
22 m_is2D = is2D; | 28 m_is2D = is2D; |
23 } | 29 } |
24 | 30 |
25 void DOMMatrix::setIs2D(bool value) | 31 void DOMMatrix::setIs2D(bool value) |
26 { | 32 { |
27 if (m_is2D) | 33 if (m_is2D) |
28 m_is2D = value; | 34 m_is2D = value; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 else | 100 else |
95 m_matrix->scale3d(sx, sy, sz); | 101 m_matrix->scale3d(sx, sy, sz); |
96 | 102 |
97 if (hasTranslation) | 103 if (hasTranslation) |
98 translateSelf(-ox, -oy, -oz); | 104 translateSelf(-ox, -oy, -oz); |
99 | 105 |
100 return this; | 106 return this; |
101 } | 107 } |
102 | 108 |
103 } // namespace blink | 109 } // namespace blink |
OLD | NEW |