| 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() |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 m_matrix = matrix; | 22 m_matrix = matrix; |
| 23 m_is2D = is2D; | 23 m_is2D = is2D; |
| 24 } | 24 } |
| 25 | 25 |
| 26 void DOMMatrix::setIs2D(bool value) | 26 void DOMMatrix::setIs2D(bool value) |
| 27 { | 27 { |
| 28 if (m_is2D) | 28 if (m_is2D) |
| 29 m_is2D = value; | 29 m_is2D = value; |
| 30 } | 30 } |
| 31 | 31 |
| 32 DOMMatrix* DOMMatrix::multiplySelf(DOMMatrix* other) |
| 33 { |
| 34 if (!other->is2D()) |
| 35 m_is2D = false; |
| 36 |
| 37 m_matrix = m_matrix * other->matrix(); |
| 38 |
| 39 return this; |
| 40 } |
| 41 |
| 42 DOMMatrix* DOMMatrix::preMultiplySelf(DOMMatrix* other) |
| 43 { |
| 44 if (!other->is2D()) |
| 45 m_is2D = false; |
| 46 |
| 47 m_matrix = other->matrix() * m_matrix; |
| 48 |
| 49 return this; |
| 50 } |
| 51 |
| 32 DOMMatrix* DOMMatrix::translateSelf(double tx, double ty, double tz) | 52 DOMMatrix* DOMMatrix::translateSelf(double tx, double ty, double tz) |
| 33 { | 53 { |
| 34 if (!tx && !ty && !tz) | 54 if (!tx && !ty && !tz) |
| 35 return this; | 55 return this; |
| 36 | 56 |
| 37 if (tz) | 57 if (tz) |
| 38 m_is2D = false; | 58 m_is2D = false; |
| 39 | 59 |
| 40 if (m_is2D) | 60 if (m_is2D) |
| 41 m_matrix.translate(tx, ty); | 61 m_matrix.translate(tx, ty); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 else | 94 else |
| 75 m_matrix.scale3d(sx, sy, sz); | 95 m_matrix.scale3d(sx, sy, sz); |
| 76 | 96 |
| 77 if (hasTranslation) | 97 if (hasTranslation) |
| 78 translateSelf(-ox, -oy, -oz); | 98 translateSelf(-ox, -oy, -oz); |
| 79 | 99 |
| 80 return this; | 100 return this; |
| 81 } | 101 } |
| 82 | 102 |
| 83 } // namespace blink | 103 } // namespace blink |
| OLD | NEW |