| 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(ExceptionState& exceptionState) | 9 DOMMatrix* DOMMatrix::create(ExceptionState& exceptionState) |
| 10 { | 10 { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 m_is2D = false; | 117 m_is2D = false; |
| 118 | 118 |
| 119 if (m_is2D) | 119 if (m_is2D) |
| 120 m_matrix->translate(tx, ty); | 120 m_matrix->translate(tx, ty); |
| 121 else | 121 else |
| 122 m_matrix->translate3d(tx, ty, tz); | 122 m_matrix->translate3d(tx, ty, tz); |
| 123 | 123 |
| 124 return this; | 124 return this; |
| 125 } | 125 } |
| 126 | 126 |
| 127 DOMMatrix* DOMMatrix::scaleSelf(double scale, double ox, double oy) | 127 DOMMatrix* DOMMatrix::scaleSelf(double sx) |
| 128 { | 128 { |
| 129 return scaleNonUniformSelf(scale, scale, 1, ox, oy); | 129 return scaleSelf(sx, sx); |
| 130 } | 130 } |
| 131 | 131 |
| 132 DOMMatrix* DOMMatrix::scale3dSelf(double scale, double ox, double oy, double oz) | 132 DOMMatrix* DOMMatrix::scaleSelf(double sx, double sy, double sz, |
| 133 { | |
| 134 return scaleNonUniformSelf(scale, scale, scale, ox, oy, oz); | |
| 135 } | |
| 136 | |
| 137 DOMMatrix* DOMMatrix::scaleNonUniformSelf(double sx, double sy, double sz, | |
| 138 double ox, double oy, double oz) | 133 double ox, double oy, double oz) |
| 139 { | 134 { |
| 140 if (sz != 1 || oz) | 135 if (sz != 1 || oz) |
| 141 m_is2D = false; | 136 m_is2D = false; |
| 142 | 137 |
| 143 if (sx == 1 && sy == 1 && sz == 1) | 138 if (sx == 1 && sy == 1 && sz == 1) |
| 144 return this; | 139 return this; |
| 145 | 140 |
| 146 bool hasTranslation = (ox || oy || oz); | 141 bool hasTranslation = (ox || oy || oz); |
| 147 | 142 |
| 148 if (hasTranslation) | 143 if (hasTranslation) |
| 149 translateSelf(ox, oy, oz); | 144 translateSelf(ox, oy, oz); |
| 150 | 145 |
| 151 if (m_is2D) | 146 if (m_is2D) |
| 152 m_matrix->scaleNonUniform(sx, sy); | 147 m_matrix->scaleNonUniform(sx, sy); |
| 153 else | 148 else |
| 154 m_matrix->scale3d(sx, sy, sz); | 149 m_matrix->scale3d(sx, sy, sz); |
| 155 | 150 |
| 156 if (hasTranslation) | 151 if (hasTranslation) |
| 157 translateSelf(-ox, -oy, -oz); | 152 translateSelf(-ox, -oy, -oz); |
| 158 | 153 |
| 159 return this; | 154 return this; |
| 160 } | 155 } |
| 161 | 156 |
| 157 DOMMatrix* DOMMatrix::scale3dSelf(double scale, double ox, double oy, double oz) |
| 158 { |
| 159 return scaleSelf(scale, scale, scale, ox, oy, oz); |
| 160 } |
| 161 |
| 162 DOMMatrix* DOMMatrix::skewXSelf(double sx) | 162 DOMMatrix* DOMMatrix::skewXSelf(double sx) |
| 163 { | 163 { |
| 164 m_matrix->skewX(sx); | 164 m_matrix->skewX(sx); |
| 165 return this; | 165 return this; |
| 166 } | 166 } |
| 167 | 167 |
| 168 DOMMatrix* DOMMatrix::skewYSelf(double sy) | 168 DOMMatrix* DOMMatrix::skewYSelf(double sy) |
| 169 { | 169 { |
| 170 m_matrix->skewY(sy); | 170 m_matrix->skewY(sy); |
| 171 return this; | 171 return this; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 191 setM41(NAN); | 191 setM41(NAN); |
| 192 setM42(NAN); | 192 setM42(NAN); |
| 193 setM43(NAN); | 193 setM43(NAN); |
| 194 setM44(NAN); | 194 setM44(NAN); |
| 195 setIs2D(false); | 195 setIs2D(false); |
| 196 } | 196 } |
| 197 return this; | 197 return this; |
| 198 } | 198 } |
| 199 | 199 |
| 200 } // namespace blink | 200 } // namespace blink |
| OLD | NEW |