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 return new DOMMatrix(TransformationMatrix()); | 10 return new DOMMatrix(TransformationMatrix()); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 return this; | 176 return this; |
177 } | 177 } |
178 | 178 |
179 DOMMatrix* DOMMatrix::scale3dSelf(double scale, | 179 DOMMatrix* DOMMatrix::scale3dSelf(double scale, |
180 double ox, | 180 double ox, |
181 double oy, | 181 double oy, |
182 double oz) { | 182 double oz) { |
183 return scaleSelf(scale, scale, scale, ox, oy, oz); | 183 return scaleSelf(scale, scale, scale, ox, oy, oz); |
184 } | 184 } |
185 | 185 |
| 186 DOMMatrix* DOMMatrix::rotateSelf(double rotX) { |
| 187 return rotateSelf(0, 0, rotX); |
| 188 } |
| 189 |
| 190 DOMMatrix* DOMMatrix::rotateSelf(double rotX, double rotY) { |
| 191 return rotateSelf(rotX, rotY, 0); |
| 192 } |
| 193 |
| 194 DOMMatrix* DOMMatrix::rotateSelf(double rotX, double rotY, double rotZ) { |
| 195 if (rotZ) |
| 196 m_matrix->rotate3d(0, 0, 1, rotZ); |
| 197 |
| 198 if (rotY) { |
| 199 m_matrix->rotate3d(0, 1, 0, rotY); |
| 200 m_is2D = false; |
| 201 } |
| 202 |
| 203 if (rotX) { |
| 204 m_matrix->rotate3d(1, 0, 0, rotX); |
| 205 m_is2D = false; |
| 206 } |
| 207 |
| 208 return this; |
| 209 } |
| 210 |
| 211 DOMMatrix* DOMMatrix::rotateFromVectorSelf(double x, double y) { |
| 212 m_matrix->rotate(rad2deg(atan2(y, x))); |
| 213 return this; |
| 214 } |
| 215 |
186 DOMMatrix* DOMMatrix::rotateAxisAngleSelf(double x, | 216 DOMMatrix* DOMMatrix::rotateAxisAngleSelf(double x, |
187 double y, | 217 double y, |
188 double z, | 218 double z, |
189 double angle) { | 219 double angle) { |
190 m_matrix->rotate3d(x, y, z, angle); | 220 m_matrix->rotate3d(x, y, z, angle); |
191 | 221 |
192 if (x != 0 || y != 0) | 222 if (x != 0 || y != 0) |
193 m_is2D = false; | 223 m_is2D = false; |
194 | 224 |
195 return this; | 225 return this; |
(...skipping 13 matching lines...) Expand all Loading... |
209 if (m_matrix->isInvertible()) { | 239 if (m_matrix->isInvertible()) { |
210 m_matrix = TransformationMatrix::create(m_matrix->inverse()); | 240 m_matrix = TransformationMatrix::create(m_matrix->inverse()); |
211 } else { | 241 } else { |
212 setNAN(); | 242 setNAN(); |
213 setIs2D(false); | 243 setIs2D(false); |
214 } | 244 } |
215 return this; | 245 return this; |
216 } | 246 } |
217 | 247 |
218 } // namespace blink | 248 } // namespace blink |
OLD | NEW |