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 27 matching lines...) Expand all Loading... |
38 m_is2D = false; | 38 m_is2D = false; |
39 | 39 |
40 if (m_is2D) | 40 if (m_is2D) |
41 m_matrix.translate(tx, ty); | 41 m_matrix.translate(tx, ty); |
42 else | 42 else |
43 m_matrix.translate3d(tx, ty, tz); | 43 m_matrix.translate3d(tx, ty, tz); |
44 | 44 |
45 return this; | 45 return this; |
46 } | 46 } |
47 | 47 |
| 48 DOMMatrix* DOMMatrix::scaleSelf(double scale, double ox, double oy) |
| 49 { |
| 50 return scaleNonUniformSelf(scale, scale, 1, ox, oy); |
| 51 } |
| 52 |
| 53 DOMMatrix* DOMMatrix::scale3dSelf(double scale, double ox, double oy, double oz) |
| 54 { |
| 55 return scaleNonUniformSelf(scale, scale, scale, ox, oy, oz); |
| 56 } |
| 57 |
| 58 DOMMatrix* DOMMatrix::scaleNonUniformSelf(double sx, double sy, double sz, |
| 59 double ox, double oy, double oz) |
| 60 { |
| 61 if (sz != 1 || oz) |
| 62 m_is2D = false; |
| 63 |
| 64 if (sx == 1 && sy == 1 && sz == 1) |
| 65 return this; |
| 66 |
| 67 bool hasTranslation = (ox || oy || oz); |
| 68 |
| 69 if (hasTranslation) |
| 70 translateSelf(ox, oy, oz); |
| 71 |
| 72 if (m_is2D) |
| 73 m_matrix.scaleNonUniform(sx, sy); |
| 74 else |
| 75 m_matrix.scale3d(sx, sy, sz); |
| 76 |
| 77 if (hasTranslation) |
| 78 translateSelf(-ox, -oy, -oz); |
| 79 |
| 80 return this; |
| 81 } |
| 82 |
48 } // namespace blink | 83 } // namespace blink |
OLD | NEW |